Pressure as a function of crank angle

5 ビュー (過去 30 日間)
Jonathan Bird
Jonathan Bird 2019 年 11 月 23 日
回答済み: Star Strider 2019 年 11 月 23 日
I need to plot pressure as a function of crank angle using the following eqaution p=(pm*SQRT(1-c^2))/(1-c*cos(alpha-delta)). Ive calculated all the required variables below but Im having trouble plotting with a for loop, any suggestions please?
V_se=7000;
V_sc=250;
v=V_sc/V_se;
T_e=333;
T_c=293;
t=T_c/T_e;
phi=pi/2;
T_r=312.6;
%let V_de=1000, V_r=500, V_dc=50
V_de=1000;
V_r=500;
V_dc=50;
V_d=V_de+V_r+V_dc;
T_d=324.7;
s=(V_d/V_se)*(T_c/T_d);
B=t+1+v+2*s;
A=sqrt(t^2-2*t+1+2*(t-1)*v*cos(phi)+v^2);
c=A/B;
p_m=1.01325;
%p_max=p_m*(sqrt(1+c)/sqrt(1-c));
%p_min=p_m*(sqrt(1-c)/sqrt(1+c));
delta=atan((v*sin(phi))/(t-1+v*cos(phi)));
for alpha=0:2*pi
p=(p_m*sqrt(1-c^2))/(1-c*cos(alpha-delta));
plot (alpha,p)
end,.,.

採用された回答

Star Strider
Star Strider 2019 年 11 月 23 日
Two options for the plot, depending on what you want to do:
Plot in the loop:
figure
hold all
for alpha=0:0.2:2*pi
p=(p_m*sqrt(1-c^2))/(1-c*cos(alpha-delta));
plot (alpha,p, 'p')
end
hold off
plot (alpha,p, 'p')
xlabel('\alpha')
ylabel('p')
Plot after the loop:
alpha=0:0.2:2*pi;
for k = 1:numel(alpha)
p(k) = (p_m*sqrt(1-c^2))/(1-c*cos(alpha(k)-delta));
end
figure
plot (alpha,p, '-p')
xlabel('\alpha')
ylabel('p')
Make appropriate changes to get the result you want.
Before the plot loop (everything up to and including the ‘delta’ assignment), your code is unchanged.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by