its giving me a matrix dimension must agree error

a1 = 1448.96;
a2 = 4.591;
a3 = -5.304*10.^-2;
a4 = 2.374*10.^-4;
a5 = 1.340;
a6 = 1.630*10.^-2;
a7 = 1.675*10.^-7;
a8 = -1.025*10.^-2;
a9 = -7.139*10.^-13;
T=15:2:0;
S=35;
z=500:200:4000;
%[T,z] = meshgrid(15:2:0,500:200:4000);
c = a1 + (a2.*T) + (a3.*T.^2) + (a4.*T.^3) + (a5*(S - 35)) + (a6.*z) + (a7.*z.^2) + (a8.*T.*(S - 35)) + (a9.*T.*z.^3);
plot(z,c,'-',T,c,'--');

1 件のコメント

Jan
Jan 2013 年 9 月 17 日
編集済み: Jan 2013 年 9 月 17 日
Please format your code properly and post a copy of the complete error message.

回答 (1 件)

Sebastian Winter
Sebastian Winter 2013 年 9 月 17 日
編集済み: Sebastian Winter 2013 年 9 月 17 日

0 投票

Hi,
your T is an empty matrix. If it should count backwards from 15 to 0 you have to select the interval -2 instead of 2:
T=15:-2:0;
but then T and z is still incompatible...
Best regards
Sebastian Winter

この質問は閉じられています。

質問済み:

2013 年 9 月 17 日

閉鎖済み:

2021 年 8 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by