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/

 Akzeptierte Antwort

Roger Stafford
Roger Stafford am 12 Jun. 2016
Bearbeitet: Roger Stafford am 12 Jun. 2016

0 Stimmen

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);

Weitere Antworten (0)

Kategorien

Mehr zu Mathematics finden Sie in Hilfe-Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by