Filter löschen
Filter löschen

Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

I want to use last value of p2 so using p2(14) but its showing error

1 Ansicht (letzte 30 Tage)
nitin pal
nitin pal am 30 Jul. 2019
Geschlossen: MATLAB Answer Bot am 20 Aug. 2021
ps=1.01325*10^5;
ds=1.225;
ts=288.16;
a1= -6.5;
c= -(9810/287)/a1;
b= 1:11;
for t=1:length(b)
t1= ts+ a1*(t);
p= ps*(t1/ts).^c;
d= ds*(t1/ts).^(c-1);
disp(p);
disp(d);
disp(t1);
end
qa= -(9810/(287))/t1 ;
e= 12:25;
j= 11;
for h= 11:length(e)
p2=p*exp(qa*(e-j));
d2=d*exp(qa*(e-j));
disp(p2);
disp(d2);
end
a2= 3;
c2= -(9810/287)/a2;
b1= 25:47;
d1=25;
for ta=1:length(b1)
t2= t1+ a2*(b1-d1);
p3= p2(14)*(t2/t1).^c2;
d3= d2*(t2/t1).^(c2-1);
disp(p3);
disp(d3);
disp(t2);
end
in the last loop I want to use last value of p2 so I am using p2(14) but its not happening and its showing error. How can I fix it??

Antworten (1)

Eva-Maria Weiss
Eva-Maria Weiss am 30 Jul. 2019
Hi nitin pal,
p2(14) works fine in your code;
When I run your code it's going till
d3= d2*(t2/t1).^(c2-1);
right? So the error message 'Innermatrix dimension must agree' apears sincs (t2/t1) results in an 1x23 vector, while d2 has a length of 14;
Maybe you could check that.

Diese Frage ist geschlossen.

Community Treasure Hunt

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

Start Hunting!

Translated by