Function handle with integrals of multiple equations?
Afficher commentaires plus anciens
Thank you for answering
6 commentaires
David Hill
le 4 Avr 2020
Is gamma scalar or is it a function of T? If it is a function of T, then what is the function?
Deema Khunda
le 4 Avr 2020
Modifié(e) : Walter Roberson
le 4 Avr 2020
Deema Khunda
le 4 Avr 2020
Ameer Hamza
le 4 Avr 2020
what are the values of V1, P1, T1 and V2?
Torsten
le 4 Avr 2020
You don't need Cp since gamma=Cp/Cp-R =1-R :-)
I think you meant gamma = Cp/(Cp-R).
Torsten
le 4 Avr 2020
gamma=Cp/(Cp-1) ?
I thought gamma=Cp/(Cp-R) ...
Réponse acceptée
Plus de réponses (1)
Ameer Hamza
le 4 Avr 2020
Modifié(e) : Ameer Hamza
le 5 Avr 2020
This solves the equations using symbolic equations
syms V P T P2 T2
A= -0.703029;
B= 108.4773;
C= -42.52157;
D= 5.862788;
E= 0.678565;
P1= 2.7;
T1= 300;
V2= 30;
R=8;
t = T/1000;
Cp= A+B*t+C*(t^2)+D*(t^3)+E/(t^2);
gamma = Cp/(Cp-R);
V_val = 230:-0.5:V2;
P2_sol = zeros(size(V_val));
T2_sol = zeros(size(V_val));
gamma_vec = zeros(size(V_val));
for i=1:numel(V_val)
V1 = V_val(i);
eq1_lhs = int(1/P, P1, P2);
eq1_rhs = int(gamma/(gamma-1)/T, T1, T2);
eq2_lhs = int(1/V, V1, V2);
eq2_rhs = -int(1/(gamma-1)/T, T1, T2);
sol = vpasolve([eq1_lhs==eq1_rhs, eq2_lhs==eq2_rhs], [P2 T2]);
P2_sol(i) = sol.P2; % solution for P2
T2_sol(i) = sol.T2; % solution for T2
gamma_vec(i) = subs(gamma, sol.T2);
end
%%
T = table(V_val', real(P2_sol)', T2_sol', gamma_vec', 'VariableNames', {'V1', 'P2', 'T2', 'gamma'});
Since this is using the symbolic toolbox, so the speed of execution can be slow. It will take a few minutes to finish.
[Note] As you mentioned in comment to Star Strider's comment, the volume is decreasing, but remember we start with V1 = 230, and end at V2 = 30, so in that case, we will maximum change in volume, and hence the maximum change in temperature and pressure. Now suppose we start at V1 = 150 and end at V1 = 30, the difference in volume is small, and therefore the change in temperature and pressure will also be small. I hope this clearify the confusion about decreasing values of P2 and T2 when we decrease V1.
10 commentaires
Torsten
le 4 Avr 2020
eq1_rhs = int(gamma/(gamma-1)/T,T1,T2)
eq2_rhs = int(-1/(gamma-1)/T,T1,T2)
Ameer Hamza
le 4 Avr 2020
Torsten, thanks for pointing out. I overlooked it.
Deema Khunda
le 4 Avr 2020
Ameer Hamza
le 4 Avr 2020
Do you mean increase from V2 to V1 in steps of 0.5? V1 is larger, and V2 is smaller.
Deema Khunda
le 4 Avr 2020
Ameer Hamza
le 4 Avr 2020
So, if i understand correctly, you want to keep V2 constant, and vary the value of V1 from 230 to 30 in steps of 0.5?
Deema Khunda
le 4 Avr 2020
Ameer Hamza
le 4 Avr 2020
Check the updated answer. Also refer to the note at the end for confusion about the values of P2 and T2.
Deema Khunda
le 5 Avr 2020
Ameer Hamza
le 5 Avr 2020
Deema, thats correct. That was a mistake in my code. Please check the updated answer. The value of gamma at T=T2 is also added to the table.
Catégories
En savoir plus sur Mathematics dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!




