hi i created a program using matlab (file attached) , when i run the program an error appear ??? Error using ==> mtimes Inner matrix dimensions must agree.
Error in ==> you7rich at 18 T=T0+(s1+s2+s3+s4+s5)*exp(-Z/Zd); i would appeciate you help thanx in advance /sorry for my english/

 채택된 답변

Roger Stafford
Roger Stafford 2016년 6월 12일
편집: Roger Stafford 2016년 6월 12일

0 개 추천

As it stands, your ‘Z’ variable is empty. You write: “Z=10*10^-2:60*10^-6;”, and the colon operator by default counts up by one each step, but your last entry is less than the first one, so Z contains no elements.
However, if we suppose that to be corrected, then (s1+s2+s3+s4+s5) and exp(-Z/Zd) are both row vectors and the ‘*’ matrix multiplication operator would not work properly. That is very likely what the error message is caused by. You need to use ‘.*’ (with a dot for element-wise multiplication:)
T=T0+(s1+s2+s3+s4+s5).*exp(-Z/Zd);

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Mathematics에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by