Borrar filtros
Borrar filtros

Chem Thermo homework help

2 visualizaciones (últimos 30 días)
HUH
HUH el 10 de Oct. de 2014
Respondida: Star Strider el 10 de Oct. de 2014
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')

Respuestas (1)

Star Strider
Star Strider el 10 de Oct. de 2014
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?

Categorías

Más información sobre Biotech and Pharmaceutical en Help Center y File Exchange.

Etiquetas

Aún no se han introducido etiquetas.

Community Treasure Hunt

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

Start Hunting!

Translated by