Pressure as a function of crank angle
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Jonathan Bird
am 23 Nov. 2019
Beantwortet: Star Strider
am 23 Nov. 2019
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,.,.
0 Kommentare
Akzeptierte Antwort
Star Strider
am 23 Nov. 2019
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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!