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!