Error: Inner Matrix Dimension Must Agree
조회 수: 5(최근 30일)
표시 이전 댓글
clc
clear all
Vd = 0:0.1:0.7
P = ((0.6*Vd)-((Vd*1.5*10^-12)*(exp(38.64*Vd)-1)))
plot(Vd,P)
when i run this code itgives me error : Inner Matrix Dimension Must Agree ?
What changes should i do to get my code correct ?
댓글 수: 0
채택된 답변
David Hill
2020년 1월 16일
Vd = 0:0.1:0.7;
P = ((0.6*Vd)-((Vd*1.5*10^-12).*(exp(38.64*Vd)-1)));%just need a dot (.*)
plot(Vd,P)
댓글 수: 2
David Hill
2020년 1월 16일
scarlar * matrix/vector ok to use *, but matrix * matrix (same size) must use .* for element-wise multiplication (* is reserved for matrix multiplication).
element-wise
1./matrix;
Matrix.*matrix;
matrix.^2;
2.^matrix;
추가 답변(1개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!