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/

 Accepted Answer

Roger Stafford
Roger Stafford on 12 Jun 2016
Edited: Roger Stafford on 12 Jun 2016
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);

More Answers (0)

Categories

Find more on Mathematics in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!