Answered step by step
Verified Expert Solution
Question
1 Approved Answer
can you correct this code on matlab and compleat the code to find pressure saturation and fugacity liquid and fugacity for vapor when philiq equal
can you correct this code on matlab and compleat the code to find pressure saturation and fugacity liquid and fugacity for vapor when philiq equal phivap for each tempretaure.Tc ; Critical temperature in K
Pc e; Critical pressure in Pa
omega ; Acentric factor
Universal gas constant
R ; Jmol K
b R Tc Pc;
kappa omega omega;
Reduced temperatures
Tr ;
loop
for i:lengthT
TTri;
Tr T Tc;
alpha kappa sqrtT Tc;
a R Tc Pc alpha;
initial guess for psat pa
if Tr
psat;
end
if Tr
psat;
end
if Tr
psat;
end
if Tr
psat ;
end
tolerance e;
error;
while error tolerance
solve
A apsatR T;
B bpsat R T;
coeffs B ABBABBB;
zrootscoeffs;
zreal zimagz; keep one real root
zmin minz;
zmax maxz;
calculate fugacity coefficient
philiq expzminlogzminBAsqrtBlogzminsqrtBzminsqrtB;
phivap expzmaxlogzmaxBAsqrtBlogzmaxsqrtBzmaxsqrtB;
calculate psat new
psatnew psatphiliqphivap;
error absphiliqphivap;
psat psatnew ;
end
end
calculate volumes
Vliq zminRTpsat;
Vvap zmaxRTpsat;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started