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/

 Réponse acceptée

Roger Stafford
Roger Stafford le 12 Juin 2016
Modifié(e) : Roger Stafford le 12 Juin 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);

Plus de réponses (0)

Catégories

En savoir plus sur Mathematics dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by