plot lines not showing up
Show older comments
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 Comment
Ankit Sahay
on 3 Sep 2020
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.
Accepted Answer
More Answers (1)
Alan Stevens
on 3 Sep 2020
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 Comment
KSSV
on 3 Sep 2020
You have not intialized P1,P2,Po1,Po2.....
Every time they are being plotted in loop.
Categories
Find more on Digital Filter Design in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!