Professional Documents
Culture Documents
“We accept responsibility for our role in ensuring the integrity of the work submitted by the group in which
each member participated.”
Group Members
1 10
2 10
3 10
4 10
5 10
6 10
7 10
8 10
9 10
10 10
11 10
12 10
13 10
Total 130
1. Objective:
The activity aims to solve non-linear equations using matlab functions and solve problems involving
equations of states.
3. Discussion:
At a specified temperature and pressure, solving equations of state allows us to find the specific
volume of a gaseous mixture of chemicals. It would be impossible to design a chemical plant without using
equations of state. By the knowledge of specific volume, one can determine the size, and thus, cost of the
plant, including the diameter of pipes, the horsepower of compressor and pumps, and the diameter of
distillation towers and chemical reactors. To design a plant without this important information is a very
challenging task.
To calculate the enthalpy and vapor-liquid properties of mixtures, determining the specific volume is
also the first step. Calculating this enthalpy is especially important when making energy balances to reduce
energy use and help the environment.
The ideal gas equation of state , which relates the pressure, temperature and specific volume, is a
familiar equation:
This equation is quite adequate when the pressure is low (such as one atmosphere). However, many
chemical processes take place at very high pressure. For example, ammonia is made at pressures of 220
atmospheres or more. Under these conditions, the ideal gas equation of state may not be a valid
representation of reality.
The first generalization of the ideal gas law was the van der Waal’s equation of state:
where b accounts for excluded volume ( a second molecule cannot use the same space already use by the
first molecule), and a accounts for the interaction force between two molecules. This extension is just a first
step, however, it will not be a good approximation at extremely high temperatures.
The Redlich-Kwong equation of state is a modification of van der Waal’s equation of state:
where
The ω is the acentric factor, which is a tabulated quantity for many substances. Thus, the value of alpha
can be computed for each chemical and reduced temperature.
The Peng Robinson is another variation:
All these equations can be rearranged into a cubic function of specific volume. The form of the
Redlich-Kwong and Redlich-Kwong-Soave equation of state is
When given the temperature and pressure of a gaseous mixture, and the parameters a and b, then to find
the specific volume one would have to solve the cubic equation of state for specific volume.
For a pure component, the parameters a and b are determined from the critical temperature and
critical pressure, and possibly acentric factor. These are all tabulated quantities, and there are even
correlations for them in terms of vapor pressure and normal boiling point.
For mixtures, it is necessary to combine the values of a and b for each component according to the
composition of the gaseous mixture. Common mixing rules are shown below, in which the ys are the mole
fraction of each chemical in the vapor phase.
or
where
or
Thus, the only difference between the problem for a pure component and that for a mixture is in evaluation
of the parameters a and b.
4. Resources:
Matlab
5. Procedure:
1. a. To determine the value of x that will satisfy the equation:
In the parameter of fzero function, 0.5 is a value of x near to where the function crosses the x-axis.
It may also represent the best guess of the solution. Try other values. Use Table 1a for the
results.
clc
x = fzero(f, 0.5)
c. To create a function file and an m-file (filename: yourSurname_le06_p1c), the contents of the
files will be
f = cos(x) – 2*x^3;
end
For m-file:
clc
x = fzero(‘myfunction’,0.5)
2. a.To determine the graph of 2sin(x) – x1/2 + 2.5 from 0 to 4π. Issue the command in MATLAB
command window:
Notice that the graph passes the x axis near x=3. To determine the value where the graph
Notice that the graph passes the x axis near x=6. To determine the value where the graph
Notice that the graph passes the x axis near x=9. To determine the value where the graph
b. Create an m-file (filename: yourSurname_le06_p2b), for Procedure 2a. Run it. Use Table 2b for
the results.
global P T n a b R
R=0 08206;
Vest = n*R*T/P;
V = fzero(‘Waals’, Vest)
function f = Waals(x)
global P T n a b R
f = (P + n^2*a/x^2)*(x-n*b) – n*R*T;
end
In order for the m-file and function files to work correctly, the variables P, T, n, a, b, and R are
declared global. Run the m-file. Use Table 3 for the results.
4. To determine the specific volume of n-butane at 500 K and 18 atm using Redlich –Kwong equation
of state,
a. Create a function file with the temperature, pressure, and thermodynamic properties with the
following contents:
function y = specvol(v)
pc = 37.5; % Data from Perry’s Chemical Handbook { bar*1x10^5 Pa/bar*1 atm/101,325 Pa}
%Ness/Abbot
T = 500;
p = 18;
R = 0.08205;
aRK = 0.42748*(R*Tc)^2/pc
aRK = arK*(Tc/T)^0.5
bRK = 0.08664*(T*Tc/pc)
b. To evaluate the value of v , having a guess of v=0.2, in the matlab command window issue the
command;
>>v = fzero(‘specvol’,0.2)
c. Use the command fsolve(), instead of fzero in 4b. Use Table 4 for the results.
5. To determine the molar volume for gaseous ammonia at a pressure P = 56 atm and a temperature
T = 450 K using the van der Waals equation of state for the following reduced pressures: P r =
0.0503144, 1, 2, 4, 10, and 20.
function x = waalsvol(vol)
global press a b R T
% filename: yourSurname_le6_p05b.m
clear all
format short e
global press a b R T
a = 27/64*R^2*Tcrit^2/Pcrit;
b = R*Tcrit/(8*Pcrit);
% each pass in a loop varies the press and then the volume is calculated
for j = 1:6
press = Pcrit*Preduced(j)
volguess = R*T/press;
result(j,1) = Preduced(j);
result(j,2) = vol;
end
% end of calculation
disp(result)
6. Repeat Procedure 4 using five different gases to be assigned by your instructor. Use Perry’s
Chemical Handbook/2-138 Critical Constants. Create tables for the results.
7. Repeat Procedure 5 using the same five different gases assigned to you by your instructor. Create
tables for the results.
Course: CHE205 Laboratory Exercise No.: 3.1
Group No.: 4 Section: CHE22S1
Group Members: Date Performed: October 28, 2021
Sandoval, Roheim Carol Date Submitted: November 1, 2021
Sarcon, Eunice Joi Instructor: Engr. Crispulo G. Maranan
Tacaisan, Jake Lloyd I.
Veras, Michelle E.
6. Data and Results:
1. Procedure 1
Table 1a. Solution of the non-linear equation ,cos (x) – 2x3 = 0, using fzero()
Matlab Command/s:
>> f='cos(x) – 2*x^3'
Matlab output:
f=
'cos(x) – 2*x^3'
x=
0.7214
x=
0.7214
x=
0.7214
Table 1b. Solution of the non-linear equation , cos (x) – 2x3 = 0, using an m-file
Contents of Sandoval_le06_p1b.m
clc
f = 'cos(x) - 2*x^3'; % suppress the output
x = fzero(f, 0.5)
Matlab Command/s:
x = fzero(f, 0.5)
Matlab output:
x=
0.7214
Table 1c. Solution of the non-linear equation , cos (x) – 2x3 = 0, using a function file and an m-file
Contents of the function file
function f = myfunction (x)
% x is the input and f is the output
f = cos(x) - 2*x^3;
end
Contents of Sandoval_le06_p1c.m
clc
x = fzero('myfunction',0.5)
Matlab Command/s:
>>Sandoval_le06_p1c
Matlab output:
x=
0.7214
2. Procedure 2
Figure 2a. Graph of 2sin(x) – x1/2 + 2.5 from 0 to 4π
Matlab command:
fplot(‘2*sin(x)-sqrt(x)+2.5’,[0,4*pi])
Matlab output:
Table 2a. Solution of 2sin(x) – x1/2 + 2.5 =0 using fzero()
Matlab command(where the graph passes the x axis near x=3 ) :
fplot(‘2*sin(x)-sqrt(x)+2.5’,[0,4*pi])
x1 = fzero(‘2*sin(x)-sqrt(x)+2.5’,3)
Matlab output:
x1 = 3.4664
Matlab command(where the graph passes the x axis near x=6 ) :
fplot(‘2*sin(x)-sqrt(x)+2.5’,[0,4*pi])
x2= fzero(‘2*sin(x)-sqrt(x)+2.5’,6)
Matlab output:
X2 = 6.2869
Matlab command(where the graph passes the x axis near x=9 ) :
fplot(‘2*sin(x)-sqrt(x)+2.5’,[0,4*pi])
x3=fzero(‘2*sin(x)-sqrt(x)+2.5’,9)
Matlab output:
x3= 9.1585
Table 2b. Solution of the non-linear equation , 2sin(x) – x1/2 + 2.5 =0, using an m-file
Contents of Sarcon_le06_p2b.m
clc;
%plotfplot(‘2*sin(x)-sqrt(x)+2.5’,[0,4*pi])
x1 = fzero(‘2*sin(x)-sqrt(x)+2.5’,3);
x2= fzero(‘2*sin(x)-sqrt(x)+2.5’,6);
x3=fzero(‘2*sin(x)-sqrt(x)+2.5’,9);
disp(x1)
disp(x2)
disp(x3)
Matlab Command/s:
run Sarcon_Le06_p2b.m
Matlab output:
x1 =
3.4664
X2 =
6.2869
x3=
9.1585
Table 2c. Solution of the non-linear equation , 2sin(x) – x1/2 + 2.5 =0, using a function file and an m-file
Contents of the function file
function f =myfunction(x)
%x is the input and f is the output
f=2*sin(x)-sqrt(x)+2.5;
end
Contents of Sarcon_le06_p2c.m
clc;
%plotfplot(‘myfunction’,[0,4*pi])
x1 = fzero(‘myfunction’,3);
x2= fzero(‘myfunction’,6);
x3=fzero(‘myfunction’,9);
Matlab Command/s:
run Sarcon_le06_p2c.m
Matlab output:
x1 =
3.4664
X2 =
6.2869
x3=
9.1585
3. Procedure 3
global P T n a b R
f = ((P + (((n^2)*a)/(x^2)))*(x-(n*b))) - (n*R*T);
end
Contents of Tacaisan_le06_p3.m
clc;
global P T n a b R
R=0.08206;
P=6;
T = 323.2;
n = 2;
a = 3.59;
b=0.047;
Vest = (n*R*T)/P;
V=fzero(‘Waals’, Vest)
Matlab Command/s:
>> Tacaisan_le06_p3
Matlab output:
V= 8.6613
4. Procedure 4
Table 4. Calculation of the specific volume of n-butane using
Redlich- kwong Equation of State having a function file
Contents of the function file:
function y = specvol(v)
Tc = 425.2; % Data from Perry’s Chemical Handbook/2-138 Critical Constants
pc = 37.5; % Data from Perry’s Chemical Handbook { bar*1x10^5 Pa/bar*1 atm/101,325 Pa}
% Table B.1 Characteristic Properties of Pure Species / Intro ChE Thermo/Smith/Van
%Ness/Abbot
T = 500;
p = 18;
R = 0.08205;
arK = 0.42748*(R*Tc)^2/pc
aRK = arK*(Tc/T)^0.5
bRK = 0.08664*(T*Tc/pc)
y = p*v^3-R*T*v^2+(aRK-p*bRK^2-R*T*bRK)*v-aRK*bRK;
end
5. Procedure 5
Table 5. Calculation of the volume of 2 moles of CO2 using
Van der Waals Equation of State having a function file and an m-file
Contents of the function file
function x = waalsvol(vol)
global press a b R T
x = press*vol^3-press*b*vol^2-R*T*vol^2 + a*vol-a*b;
Contents of Veras_le06_p5b.m
% filename: Veras_le6_p05b.m
clear all
format short e
global press a b R T
% set the constants
Pcrit = 111.3 ; % in atm
Tcrit = 405.5; % in Kelvin
R = 0.08206; % in li. atm/mole.K
T = 450 ; % in K
% the different values of pressure are stored in a single vector
Preduced = [ 0.0503144 1 2 4 10 20];
a = 27/64*R^2*Tcrit^2/Pcrit;
b = R*Tcrit/(8*Pcrit);
% each pass in a loop varies the press and then the volume is calculated
for j = 1:6
press = Pcrit*Preduced(j)
volguess = R*T/press;
% Use fzero or fsolve to calculate volume
vol = fzero ('waalsvol', volguess);
result(j,1) = Preduced(j);
result(j,2) = vol;
end
% end of calculation
disp('Preduced Molar Vol')
disp(result)
Matlab Command/s:
>> Veras_le06_p5b
Matlab output:
press =
5.6000e+00
press =
1.1130e+02
press =
2.2260e+02
press =
4.4520e+02
press =
1113
press =
2226
6. Procedure 6
Table 6.1 Calculation of the specific volume of Benzene using
Redlich- kwong Equation of State having a function file
Contents of the function file:
function y = specvol1(v)
Tc = 562.05; % Data from Perry’s Chemical Handbook/2-138 Critical Constants
pc = 4.895; % Data from Perry’s Chemical Handbook { bar*1x10^5 Pa/bar*1 atm/101,325 Pa}
% Table B.1 Characteristic Properties of Pure Species / Intro ChE Thermo/Smith/Van
%Ness/Abbot
T = 500;
p = 18;
R = 0.08205;
arK = 0.42748*(R*Tc)^2/pc
aRK = arK*(Tc/T)^0.5
bRK = 0.08664*(T*Tc/pc)
y = p*v^3-R*T*v^2+(aRK-p*bRK^2-R*T*bRK)*v-aRK*bRK;
end
7. Procedure 7
Table 7.1. Calculation of the volume of 2 moles of Benzene using
Van der Waals Equation of State having a function file and an m-file
Contents of the function file
function x = waalsvol(vol)
global press a b R T
x = press*vol^3-press*b*vol^2-R*T*vol^2 + a*vol-a*b;
end
Contents of Sandoval_le06_p7b.m
% filename: Sandoval_le6_p07b.m
clear all
format short e
global press a b R T
% set the constants
Pcrit = 32.77; % in atm
Tcrit = 582.82; % in Kelvin
R = 0.08206; % in li. atm/mole.K
T = 450 ; % in K
% the different values of pressure are stored in a single vector
Preduced = [ 0.0503144 1 2 4 10 20];
a = 27/64*R^2*Tcrit^2/Pcrit;
b = R*Tcrit/(8*Pcrit);
% each pass in a loop varies the press and then the volume is calculated
for j = 1:6
press = Pcrit*Preduced(j)
volguess = R*T/press;
% Use fzero or fsolve to calculate volume
vol = fzero ('waalsvol', volguess);
result(j,1) = Preduced(j);
result(j,2) = vol;
end
% end of calculation
disp('Preduced Molar Vol')
disp(result)
Matlab Command/s:
>> Sandoval_le06_p7b
Matlab output:
press =
1.6488e+00
press =
3.2770e+01
press =
6.5540e+01
press =
1.3108e+02
press =
3.2770e+02
press =
6.5540e+02
5.0314e-02 2.1765e+01
1.0000e+00 2.6293e-01
2.0000e+00 2.5240e-01
4.0000e+00 2.3987e-01
1.0000e+01 2.2245e-01
2.0000e+01 2.1039e-01
0.0503 0.1486
1.0000 0.1482
2.0000 0.1479
4.0000 0.1473
10.0000 0.1460
20.0000 0.1447
0.0503 0.1564
1.0000 0.1563
2.0000 0.1561
4.0000 0.1558
10.0000 0.1551
20.0000 0.1544
0.0503 0.1757
1.0000 0.1756
2.0000 0.1754
4.0000 0.1752
10.0000 0.1748
20.0000 0.1742
0.0503 -9.0722
1.0000 0.2369
2.0000 0.2374
4.0000 0.2384
10.0000 0.2409
20.0000 0.2439
7. Conclusion:
We therefore conclude that with the use of MATLAB programming, we can easily solve different
nonlinear equations, most especially in Chemical Engineering equations. Using MATLAB, we have solved
for specific volumes using the Redlich-Kwong and Van der Waals equations. Familiarizing and
understanding the different MATLAB features can help us easily obtain the required results.