Area enclosed within a curve
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I'm trying to find the enclosed area for two curves, shown in the plot titled "Ideal and Schmidt pV Diagrams". I think using the "trapz" function should work but im not sure how to discretise the x-axis, thank you for any suggestions.
V_se=0.00008747;
V_sc=0.00004106;
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=0.000010;
V_r=0.000050;
V_dc=0.000010;
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=101325;
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)));
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)
xlabel('\alpha')
ylabel('p')
% min = min(p);
alpha=0:0.2:2*pi;
for k = 1:numel(alpha)
V_total(k) = (V_se/2)*(1-cos(alpha(k)))+(V_se/2)*(1+cos(alpha(k)))+(V_sc/2)*(1-cos(alpha(k)-phi))+V_d;
end
figure
plot (alpha,V_total)
xlabel('\alpha')
ylabel('V_total')
alpha=0:0.0001:2*pi;
for k = 1:numel(alpha)
p_1(k) = (p_m*sqrt(1-c^2))/(1-c*cos(alpha(k)+delta));
V_1_total(k) = (V_se/2)*(1-cos(alpha(k)))+(V_se/2)*(1+cos(alpha(k)))+(V_sc/2)*(1-cos(alpha(k)-phi))+V_d;
end
p_start = (p_m*sqrt(1-c^2))/(1-c*cos(0-delta));
P_mid = (p_m*sqrt(1-c^2))/(1-c*cos(pi-delta));
figure
plot (V_1_total,p_1)
xlabel('V_total')
ylabel('p')
hold on
plot(Vv1, p_2(Tv1,Vv1), 'LineWidth',2)
plot(Vv1, p_2(Tv2,Vv1), 'LineWidth',2)
plot(Vv1(1)*[1 1], p_2([Tv1(1) Tv1(end)],[1 1]*Vv1(1)), '-k', 'LineWidth',2)
plot(Vv1(end)*[1 1], p_2([Tv2(1) Tv2(end)],[1 1]*Vv1(end)), '-k', 'LineWidth',2)
title('Ideal and Schmidt pV Diagrams')
hold off
% I = trapz(V_1_total,p)
5 Kommentare
dpb
am 6 Dez. 2019
Update the code in the original; then use the 'Code' button to format it legibily/neatly...
Probably if you just generated the final data to create the plot and attached it would be simpler--how you generated the curves is really of not much import here I think...unless you want to try symbolic integration (and I don't have toolbox to try).
Antworten (0)
Siehe auch
Kategorien
Mehr zu Thermodynamics and Heat Transfer 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!