フィルターのクリア

Chem Thermo homework help

2 ビュー (過去 30 日間)
HUH
HUH 2014 年 10 月 10 日
回答済み: Star Strider 2014 年 10 月 10 日
Alright, I'm trying to figure out why at this point in my code
phi=(phi_p_v)*(P_v/P)*exp((V_sat*(P-P_v))/(R*T))
it is only giving me a single number. Why wont P_v divide by the matrix P up to the number 22.27? I tried using P_v./P but it still doesn't work. Any help will be appreciated.
%Problem 11.24 part A
%Assuming that Eq (11.68) is valid for the vapor phase and that the molar
%volume of saturated liquid is given by eq (3.72), prepare plots of f vs P
%and of phi vs. P for Chloroform at 200 degrees Celcius for the pressure
%range from 0-40 bar. At 200 degrees Celcius, the vapor pressure of
%chloroform is 22.27 bar.
clear
clc
%Given
P=[0:40]';
P_v=22.27; %bar
T=200+273.12; %K
R=8.314
P_c=54.72; %bar
T_c=536.4; %K
w=.222;
V_c=239; %cm^3/mol
Z_c=.265;
%Find T_r
T_r=T/T_c
P_r=P/P_c
%Find V_sat
V_sat=(V_c)*(Z_c)^((1-T_r)^(2/7))
%Find B_0 and B_1
B_0=0.083-(.422/(T_r^1.6))
B_1=.139-(.172/(T_r^4.2))
%For P<=P_sat
phi_p_v=exp((P_v/P_c)/(T_r)*(B_0+w*B_1));
if P<=P_v
phi=(phi_p_v)*(P_v/P)*exp((V_sat*(P-P_v))/(R*T))
else
phi=exp((P_r)/(T_r)*(B_0+w*B_1))
end
%Graph them
plot (P,phi)
title ('phi vs. P')
xlabel ('Pressure, bar')
ylabel ('phi')

回答 (1 件)

Star Strider
Star Strider 2014 年 10 月 10 日
You need to test each value of ‘P’, then do the appropriate calculation:
for k1 = 1:length(P)
Pn = P(k1);
if Pn<=P_v
phi(k1)=(phi_p_v)*(P_v./Pn).*exp((V_sat*(Pn-P_v))/(R*T));
else
phi(k1)=exp((P_r(k1))/(T_r)*(B_0+w*B_1));
end
end
I created ‘Pn’ for each value of ‘P’ and changed the first ‘phi’ equation to accommodate it. That also required subscripting ‘P_r’ and subscripting ‘phi’ in both equations.
Does this do what you want?

カテゴリ

Help Center および File ExchangeBiotech and Pharmaceutical についてさらに検索

タグ

タグが未入力です。

Community Treasure Hunt

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

Start Hunting!

Translated by