Function handle with integrals of multiple equations?
이전 댓글 표시
Thank you for answering
댓글 수: 6
David Hill
2020년 4월 4일
Is gamma scalar or is it a function of T? If it is a function of T, then what is the function?
Deema Khunda
2020년 4월 4일
편집: Walter Roberson
2020년 4월 4일
Deema Khunda
2020년 4월 4일
Ameer Hamza
2020년 4월 4일
what are the values of V1, P1, T1 and V2?
Torsten
2020년 4월 4일
You don't need Cp since gamma=Cp/Cp-R =1-R :-)
I think you meant gamma = Cp/(Cp-R).
Torsten
2020년 4월 4일
gamma=Cp/(Cp-1) ?
I thought gamma=Cp/(Cp-R) ...
채택된 답변
추가 답변 (1개)
Ameer Hamza
2020년 4월 4일
편집: Ameer Hamza
2020년 4월 5일
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
Torsten
2020년 4월 4일
eq1_rhs = int(gamma/(gamma-1)/T,T1,T2)
eq2_rhs = int(-1/(gamma-1)/T,T1,T2)
Ameer Hamza
2020년 4월 4일
Torsten, thanks for pointing out. I overlooked it.
Deema Khunda
2020년 4월 4일
Ameer Hamza
2020년 4월 4일
Do you mean increase from V2 to V1 in steps of 0.5? V1 is larger, and V2 is smaller.
Deema Khunda
2020년 4월 4일
Ameer Hamza
2020년 4월 4일
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
2020년 4월 4일
Ameer Hamza
2020년 4월 4일
Check the updated answer. Also refer to the note at the end for confusion about the values of P2 and T2.
Deema Khunda
2020년 4월 5일
Ameer Hamza
2020년 4월 5일
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.
카테고리
도움말 센터 및 File Exchange에서 Mathematics에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!




