How can I plot multiple lines on the graph?
2 views (last 30 days)
Show older comments
Hello! I'm trying to graph a matching plot for aircraft sizing. However, only one plot is showing. How can I display all the other lines? My code is below:
Vs = 141;
Vc = 822;
Vmax = 1210;
Vto = 150;
Vr = Vto;
hc = 41000;
hac = 51000;
Clmax = 1.8;
e = 0.81;
AR = 8;
K = 0.049;
g = 32.2;
Cd0 = 0.017;
Cd0to = 0.032;
Clto = 1;
Cdto = 0.037;
Cdg = 0.001;
Clr = 1.48;
nu = 0.04;
Sto = 4000;
rhosl = 0.002378;
rhoc = 0.00056;
rhoac = 0.000347;
mupac = 0.235;
LDmax = 15;
ROCAC = 0;
ROCSC = 100;
ROCCrC = 3500;
ROCCoC = 500;
% Stall speed.
WS = 1/2*rhosl*Vs^2*Clmax;
x1 = WS;
x2 = WS;
y1 = 0;
y2 = 1.5;
plot([x1,x2],[y1,y2],'-g')
text(55,1.2,'Stall speed')
xlabel('W/S, lb/ft^2')
ylabel('T/W, lb/lb')
grid on
hold on
% Maximum speed.
WSms = 0:2:80;
TWvmax = (59./2*(W/S))+((0.00051)*(WS));
plot(WSms,TWvmax,'--r')
text(10,-0.05,'Maximum speed')
% Take-off run.
TWsto = (nu-(nu+Cdg/Clr).*(exp(0.6*rhosl*g*Cdg*Sto)./WSms))./((1-exp(0.6*rhosl*g*Cdg*Sto)./WSms));
plot(WSms, TWsto,'b--o')
text(5,1.2,'Take-off run')
% Rate of climb.
TWroc = (3500./(sqrt(451.*WSms)))+(1./15);
plot(WSms, TWroc,'*-c')
text(5,0.3,'Rate of climb')
% Cruise ceiling.
TWhc = (100./(0.19*sqrt(2324*WSms)))+(1./2.85);
plot(WSms, TWhc,'*-y')
text(10,0.5,'Cruise ceiling')
% Find design plot coordinates.
[xint,yint] = polyxpoly([x1,x2],[y1,y2],WSms,TWvmax);
plot(xint,yint,'ok')
text(65,-0.2,'Design point')
disp([xint,yint])
0 Comments
Accepted Answer
madhan ravi
on 24 Dec 2018
hold on % after the first plot command
12 Comments
madhan ravi
on 24 Dec 2018
Edited: madhan ravi
on 24 Dec 2018
Anytime :) , make sure to accept the answer if it worked.
After all it was just to add hold on after the first plot command as I suggested at the very beginning.
More Answers (0)
See Also
Categories
Find more on Interactive Control and Callbacks 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!
