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 ExchangeElementary Math についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by