%% solving for T
syms T p1sat p2sat
A1= 5.158; B1= 1569.613; C1= -34.846;
% heptane
A2= 4.028; B2=1268.636; C2=-56.199;
log(p1sat)= A1-(B1/(T+C1)); p1sat= 10^(log(p1sat));
log(p2sat)= A2-(B2/(T+C2)); p2sat= 10^(log(p2sat));
x1= 0:.05:1; x2= 1-x1;
s= solve((x1.*p1sat)+(x2.*p2sat)==1, T);
T
% Response
>> attempt2nd_8_29
Warning: Unable to find explicit solution. For options, see help.
> In solve (line 317)
In attempt2nd_8_29 (line 13)
T =
T

回答 (1 件)

Star Strider
Star Strider 2019 年 8 月 29 日

0 投票

Assuming n-heptane:
syms T p1sat p2sat x1
A1= 5.158; B1= 1569.613; C1= -34.846;
clog10 = log(10);
% heptane
A2= 4.028; B2=1268.636; C2=-56.199;
p1sat = A1-(B1/(T+C1))
p2sat = A2-(B2/(T+C2))
x2 = 1-x1;
Tval = vpasolve((x1.*p1sat)+(x2.*p2sat)==1, T)
figure
fplot(Tval(1), [-5 15])
hold on
fplot(Tval(2), [-5 15])
hold off
title('CH_3(CH_2)_5CH_3')
xlabel('T')
ylabel('P_{sat}')
The Symbolic Math Toolbox log function is the natural log by definition. If you want to convert them to base-10 logs, divide them by log(10). I used natural logs here. Make appropriate changes to get the result you want.

カテゴリ

ヘルプ センター および File Exchange で MATLAB Support Packages についてさらに検索

製品

質問済み:

2019 年 8 月 29 日

回答済み:

2019 年 8 月 29 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by