Question: 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
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
