plot lines not showing up
이전 댓글 표시
clc
clear
format long
R=287;
r=1.4;
Mach=[2:0.5:6];
for i=1:9
M=Mach(1,i);
for density=1.225
To=300;
p=101325;
ao=sqrt(r*R*To);
V=ao*M;
m=M^2;
P=p*(((2*r*m)-(r-1))/(r+1));
D=density*(((r+1)*m)/(((r-1)*m)+2));
Q=(D*((V^2)/2));
Po=P+Q;
plot(Po,P,'r*')
hold on
end
for density=1.203
To=284.9;
p=99507.54;
ao=sqrt(r*R*To);
V=ao*M;
m=M^2;
D=density*(((r+1)*m)/(((r-1)*m)+2));
Q=D*((V^2)/2);
P=p*(((2*r*m)-(r-1))/(r+1));
Po=P+Q;
plot(Po,P,'ko')
hold on
end
end
hold off
xlabel('Po')
ylabel('P')
legend('Wind Tunnel','FL500','Location','northwest')
댓글 수: 1
Ankit Sahay
2020년 9월 3일
Please follow the community guidelines while asking questions. In short, explain what are you asking, why and what steps have you taken to solve your problem. Write your question in a way that a layman who has no idea of what you are trying to do can understand.
채택된 답변
추가 답변 (1개)
Alan Stevens
2020년 9월 3일
You were overwriting P all the time, instead of storing all the values:
R=287;
r=1.4;
Mach=[2:0.5:6];
for i=1:9
M=Mach(1,i);
for density=1.225
To=300;
p=101325;
ao=sqrt(r*R*To);
V=ao*M;
m=M^2;
P(i)=p*(((2*r*m)-(r-1))/(r+1)); %%%%%%%%%%%%%%%%%%%%%%%%
D=density*(((r+1)*m)/(((r-1)*m)+2));
Q=(D*((V^2)/2));
Po(i)=P(i)+Q; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
plot(Po,P,'r*')
hold on
end
for density=1.203
To=284.9;
p=99507.54;
ao=sqrt(r*R*To);
V=ao*M;
m=M^2;
D=density*(((r+1)*m)/(((r-1)*m)+2));
Q=D*((V^2)/2);
P2(i)=p*(((2*r*m)-(r-1))/(r+1)); %%%%%%%%%%%%%%%%%%%%%%%%%%%%
Po2(i)=P2(i)+Q; %%%%%%%%%%%%%%%%%%%%%%%
plot(Po2,P2,'ko')
hold on
end
end
hold off
xlabel('Po')
ylabel('P')
legend('Wind Tunnel','FL500','Location','northwest')
댓글 수: 1
KSSV
2020년 9월 3일
You have not intialized P1,P2,Po1,Po2.....
Every time they are being plotted in loop.
카테고리
도움말 센터 및 File Exchange에서 Digital Filter Design에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!