Multiple line with different variable in a plot
显示 更早的评论
Hello people, I am current working on a homework. I am supposed to have a plot that contain multiple data line with varying B and pi_o. I tried to put it into a loop but it does not seem to work, Any help will be appreciated.

Pa = 23771;
Ta = 218.789;
R = 287;
gamma = 1.4;
Mf = 0.85;
fan_isen = 0.91;
nozzle_isen = 0.985;
ec = 0.915;
press_drop_CC = 0.04;
cpg = 1148;
cp = 1005;
Qr = 43800*(10^3);
cc_burner_eff = 0.99;
mecha_eff = 0.985;
et_HP = 0.93;
gammag = 1.333;
et_LP = 0.92;
%custom
pi_fb = 1.5; %<2.1
pi_fc = 1.5; %<2.1
% pi_o = 42; %<52
T04 = 1600; %Tet<2050K
% B = 8; %<11
B = 0:0.5:10;
pi_o = 2:2:30;
for k = 1:length(pi_hp)
vf = Mf * ((gamma*Ta*R)^(1/2));
T02 = Ta * (1+((gamma-1)/2)*0.85^2);
P02 = Pa * (1+((gamma-1)/2)*0.85^2)^(gamma/(gamma-1));
%Bypass
P013 = pi_fb * P02;
T013 = T02*(1+((1/fan_isen)*((P013/P02)^(((gamma-1)/gamma)))-1));
P019 = P013;
T019 = T013;
critical_pressure_ratio = 1/(1-((1/nozzle_isen)*((gamma-1)/(gamma+1))))^(gamma/(gamma-1));
P19 = P019/critical_pressure_ratio;
T19 = T019/(1/((1-((1/nozzle_isen)*((gamma-1)/(gamma+1))))));
V19 = (gamma*R*T19)^(1/2)
%Core
P023 = pi_fc * P02;
tau_c = pi_fc^((gamma-1)/(gamma*ec));
T023 = tau_c*T02;
pi_hp = pi_o/pi_fc;
P03 = pi_hp*P023;
comp_isen = (((pi_fc^((gamma-1)/(gamma))))-1)/((pi_fc^((gamma-1)/(gamma*ec)))-1);
T03s = T023*(P03/P023).^((gamma-1)/gamma);%added dot
T03 = T023 + ((T03s-T023)/comp_isen);
P04 = (1-press_drop_CC)*P03;
f = ((cpg*T04)-(cp*T03))/(Qr - (cpg*T04));
fa = f/cc_burner_eff;
T045 = T04 - (cp*(T03-T023))/(mecha_eff*(1+fa)*cpg);
tau_t_HP = T045/T04;
HP_turb_isen = (1-tau_t_HP)/(1-(tau_t_HP^(1/et_HP)));
P045 = P04*(1-((1-(T045/T04))/(HP_turb_isen)))^(gammag/(gammag-1));
T05 = T045 - ((cp.*(T023-T02))+(B.*cp.*(T013-T02))).*(((mecha_eff.*(1+fa).*cpg))).^-1;
tau_t_LP = T05/T045;
LP_turb_isen = (1-tau_t_LP)/(1-(tau_t_LP.^(1/et_LP)));
P05 = P045.*(1-((1-tau_t_LP)/(LP_turb_isen))).^(gammag/(gammag-1));
P9 = Pa;
T9s = T05.*(((P9.*P05.^-1).^(gammag-1).*(gammag)).^-1);
T9 = nozzle_isen*(T9s-T05)+T05;
V9 = (2*cpg*(T05-T9)).^(1/2);
Ratio_of_exit_velocities = V19*(V9.^-1);
Fs = ((1.*(B+1).^-1).*((1+fa).*V9-vf))+((((1+fa).*R.*T9).*((V9.*P9.*(B+1))).^-1).*(P9-Pa))+((B./(B+1)).*(V19-vf))+(((R.*T19.*B)/(V19.*P19.*(B+1))).*(P19-Pa));
sfc = fa/((B+1).*Fs)
h = plot(pi_o, Fs);
end
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Legend 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



