필터 지우기
필터 지우기

Pressure as a function of crank angle

조회 수: 2 (최근 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 CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by