Create a MATLAB program which solves the four types of Vapor Liquid Equilibrium
ID: 702668 • Letter: C
Question
Create a MATLAB program which solves the four types of Vapor Liquid Equilibrium calculations for bubble and dew temperatures and pressures for an ideal solution with species that obey the Antoine Equation. In this program you should have: (1) a function which reads and outputs the species name, the Antoine constants; (2) a function which reads the type of calculation desired, the corresponding set of mole fractions and temperature or pressure, and uses the function of (1) to compute the temperatures or saturation pressures of each of the species and their respective K values (note this is NOT the bubble or dew temperatures or pressures but rather the pure component values). This function should output these pure component values; (3) a function which drive the corresponding constraint to zero and outputs the desired temperature, pressure, and mole fractions for the VLE calculation by using the functions of (1) and (2) and an user inputted initial guess. To exercise this program use mole fractions of 0.2 ethane, 0.5 propane, 0.30 butane, and 0.00 pentane. Use the temperature and pressure of minus 10°F and 25 psia. Submit a published page for each of the four types of calculations as a single file. Be sure there are sufficient comments and include your name in the header of each page.
Explanation / Answer
clc
clear all
disp('enter the component')
data=read('E:StudyAkilaCheggcomponent.txt',-1,1)
disp('compnent mole fractions')
disp(data(1),'ethane')
disp(data(2),'propane')
disp(data(3),'butane')
disp(data(4),'pentane')
disp(data(5),'Temperature')
disp(data(6),'Pressure')
//Antoine equation:
A=read('E:StudyAkilaCheggAntoineconstant.txt',-1,3)
T=data(5)
psat=10.^(A(:,1)-A(:,2)./(T+A(:,3)))
P=data(6)
x=data(1:4)
y=x.*psat./P