필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

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

조회 수: 1 (최근 30일)
nitin pal
nitin pal 2019년 7월 30일
마감: MATLAB Answer Bot 2021년 8월 20일
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??

답변 (1개)

Eva-Maria Weiss
Eva-Maria Weiss 2019년 7월 30일
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.

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by