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!




