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 comentario

Jan
Jan el 17 de Sept. de 2013
Editada: Jan el 17 de Sept. de 2013
Please format your code properly and post a copy of the complete error message.

Respuestas (1)

Sebastian Winter
Sebastian Winter el 17 de Sept. de 2013
Editada: Sebastian Winter el 17 de Sept. de 2013

0 votos

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

La pregunta está cerrada.

Preguntada:

el 17 de Sept. de 2013

Cerrada:

el 20 de Ag. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by