Function handle with integrals of multiple equations?
Show older comments
Thank you for answering
6 Comments
David Hill
on 4 Apr 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
on 4 Apr 2020
Edited: Walter Roberson
on 4 Apr 2020
Deema Khunda
on 4 Apr 2020
Ameer Hamza
on 4 Apr 2020
what are the values of V1, P1, T1 and V2?
Torsten
on 4 Apr 2020
You don't need Cp since gamma=Cp/Cp-R =1-R :-)
I think you meant gamma = Cp/(Cp-R).
Torsten
on 4 Apr 2020
gamma=Cp/(Cp-1) ?
I thought gamma=Cp/(Cp-R) ...
Accepted Answer
More Answers (1)
Ameer Hamza
on 4 Apr 2020
Edited: Ameer Hamza
on 5 Apr 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 Comments
Torsten
on 4 Apr 2020
eq1_rhs = int(gamma/(gamma-1)/T,T1,T2)
eq2_rhs = int(-1/(gamma-1)/T,T1,T2)
Ameer Hamza
on 4 Apr 2020
Torsten, thanks for pointing out. I overlooked it.
Deema Khunda
on 4 Apr 2020
Ameer Hamza
on 4 Apr 2020
Do you mean increase from V2 to V1 in steps of 0.5? V1 is larger, and V2 is smaller.
Deema Khunda
on 4 Apr 2020
Ameer Hamza
on 4 Apr 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
on 4 Apr 2020
Ameer Hamza
on 4 Apr 2020
Check the updated answer. Also refer to the note at the end for confusion about the values of P2 and T2.
Deema Khunda
on 5 Apr 2020
Ameer Hamza
on 5 Apr 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.
Categories
Find more on Mathematics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



