MATLAB: Plotting multiple iterations of a loop

loopsplotplotting

I am wanting to plot Thrust, spillage, and Acap from the code below but I want to have muiltipul lines for different Mdotc2. An example of what I am looking for is it would cycle through the code once get matrixs for the Thrust spillage, and Acap. Then go back to the while L ==1 loop get new values and recalculate Trust, Spillage, and Acap. It would then create plots 3 plots for the Thrust, spillage, and Acap with the data from the first loop as one line and the data from the second loop as another line on the same graph.
Thanks for any help you can provide.
while k == 1
Alt=input('Altidtide? ');
Po=input('Outside Pressure? ');
To=input('Outside Temperature? ');
z=input('Number of mdot Fuels? ');
Rhoo=Po/(R*To);
Mo=0;
L=1;
y=1;
while L == 1
Tt4ddTt2=input('Tt4/Tt2? ');
Nc2=(input('Off Design % corrected RPM ')/100)*Nc2r;
nc=input('compressor effency guess ')/100;
Pc=(input('compressor ratio guess ')/100)*Pcr;
Mdotc2=(input(' Corrected mass rate of flow guess ')/100)*Mdotc2r;
tc=1+(((Pc^((g-1)/g))-1)/nc);
tt=1-(1/Tt4ddTt2)*(tc-1);
Pt=((((tt-1)/(-nc))-1)/-1)^(g/(g-1));
for j = 1:25
M(j)=Mo;
tr=(1+((g-1)/2)*Mor^2);
Tt1=To*(1+((g-1)/2)*(Mo^2));
Pt1=Po*((1+((g-1)/2)*(Mo^2))^(g/(g-1)));
Pd=1-(.015*(Mo^2));
td=Pd^((g-1)/g);
Tt2=Tt1*td;
Pt2=Pt1*Pd;
Pt3=Pt2*Pc;
Tt3=Tt2*tc;
Tt4=Tt2*Tt4ddTt2;
Pt5=Pt3*Pt;
Tt5=Tt4*tt;
Mdot2=(Mdotc2*(Pt2/Pstp))/((Tt2/Tstp)^.5);
s=abs(mdotr-Mdot2);
M8=1;
P8=Pt5/((1+((g-1)/2)*(M8^2))^(g/(g-1)));
T8=Tt5/((1+((g-1)/2)*(M8^2)));
u8=M8*((g*R*T8)^.5);
uo=Mo*((g*R*To)^.5);
Thrust(j)=(Mdot2*u8)-(Mdot2*uo)+((P8-Po)*A8r);
Spillage(j)=s;
Acap(j)=Mdot2/(uo*Rhoo);
Nc(j)=Nc2*((Tt2/Tstp)^.5);
d=(((tr*(Tt4/Tt2))-tc)/(h/(Cp*To)));
f(j)=d;
mdotfr(j)=d*Mdot2;
Mo=Mo+.1;
end
L=input('Run again for different Mdot fuel? [1=yes] ');
end

Best Answer

Just place hold on outside your loops
hold on;
Then plot before repeating loop.
end
plot(M,Thrust,M,Spillage,M,Acap);
L=input('Run again for different Mdot fuel? [1=yes] ');
I think this may be what you are looking for but I was unsure what you wanted to plot them against. I guessed M.