You are on page 1of 27

PLEDGE OF HONOR

“We accept responsibility for our role in ensuring the integrity of the work submitted by the group in which
each member participated.”

SANDOVAL, ROHEIM CAROL SARCON, EUNICE JOI

TACAISAN, JAKE LLOYD I. VERAS, MICHELLE E.


Group No. 4

Group Members

1. SANDOVAL, ROHEIM CAROL 11/1/2021

2. SARCON, EUNICE JOI 11/1/2021

3. TACAISAN, JAKE LLOYD I. 11/1/2021

4. VERAS, MICHELLE E. 11/1/2021

Date of Activity October 28, 2021

Date of Submission November 1, 2021

Submitter’s SN GN MI Engr. Crispulo G. Maranan


Grading Criteria

Max Point Score Obtained

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

Grade (TSO/TMP x 100)

Laboratory Exercise No. 3.1


Solving Single Non-linear Equations Using Matlab

1. Objective:
The activity aims to solve non-linear equations using matlab functions and solve problems involving
equations of states.

2. Intended Learning Outcomes (ILOs):


The students shall be able to:
2.1 Use matlab functions like fsolve() and fzero() in the solution of non-linear equations.
2.2 Use function file together with an m-file to solve chemical engineering problem involving equation
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 alpha is particular to Redlich-Kwong equation of state.


The Redlich-Kwong equation of state was modified further by Soave to give the Redlich-Kwong-
Soave equation of state ( called RK-Soave ), which is common one in process simulators:
The parameter alpha is given a different formula,

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:

cos (x) – 2x3 = 0

Issue the command in MATLAB command window:

>> f=‘cos(x) – 2*x^3’

>> x = fzero(f, 0.5)

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.

b. To create an m-file (filename: yourSurname_le06_p1b), the contents will be

clc

f = ‘cos(x) – 2*x^3’; % suppress the output

x = fzero(f, 0.5)

Run the m-file. Use Table 1b for the results.

c. To create a function file and an m-file (filename: yourSurname_le06_p1c), the contents of the

files will be

For function file:

function f = myfunction (x)

% x is the input and f is the output

f = cos(x) – 2*x^3;
end

For m-file:

clc

x = fzero(‘myfunction’,0.5)

Run the m-file. Use Table 1c for the results.

2. a.To determine the graph of 2sin(x) – x1/2 + 2.5 from 0 to 4π. Issue the command in MATLAB
command window:

>> fplot('2*sin(x) - sqrt(x) + 2.5', [0,4*pi])

Use Figure 2a for the results.

Notice that the graph passes the x axis near x=3. To determine the value where the graph

crosses the x axis, issue the command:

>>x1 = fzero('2*sin(x) - sqrt(x) + 2.5',3)

Notice that the graph passes the x axis near x=6. To determine the value where the graph

crosses the x axis, issue the command:

>>x2 = fzero('2*sin(x) - sqrt(x) + 2.5',6)

Notice that the graph passes the x axis near x=9. To determine the value where the graph

crosses the x axis, issue the command:

>> x3 = fzero('2*sin(x) - sqrt(x) + 2.5',9)

Use Table 2a for the results.

b. Create an m-file (filename: yourSurname_le06_p2b), for Procedure 2a. Run it. Use Table 2b for

the results.

c. Create a function (myfunction1)and m-files (filename: yourSurname_le06_p2c), for Procedure

2a. Run the m-file. Use Table 2c for the results.

3. To calculate the volume of 2 moles of CO 2 ( a = 3.59 L3-atm/mol2, and b = 0.0427 L/mol) at


temperature of 50oC, and pressure of 6 atm using van der Waal’s equation.
( P + n2a/ V2 ) ( V – nb) = nRT

The contents of m-file ( filename: yourSurname_le06_p3) will be:

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)

The contents of function file will be:

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)

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;

Save the file.

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)

Use Table 4 for the results.

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.

a. The function file contains the following:

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;

b. The m-file contains the following:

% filename: yourSurname_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)

Run the m-file. Use Table 5 for the results.

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'

>> x = fzero('cos(x) - 2*x^3', 0.5)

>> x = fzero('cos(x) - 2*x^3', 0.6)

>> x = fzero('cos(x) - 2*x^3', 0.7)

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

Table 3. 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 [f] = Waals(x)

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

Matlab command using fzero():


>> v = fzero(‘specvol’,0.2)
Matlab output using fzero():
v=2.0377
Matlab command using fsolve():
>> v = fsolve(‘specvol’,0.2’)
Matlab output using fsolve():
v=2.0377

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

Preduced Molar Vol


5.0314e-02 6.5171e+00
1.0000e+00 2.3351e-01
2.0000e+00 7.7268e-02
4.0000e+00 6.0654e-02
1.0000e+01 5.0875e-02
2.0000e+01 4.6175e-02

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

Matlab command using fzero():


>> v = fzero(‘specvol1’,0.2)
Matlab output using fzero():
v=1.8659
Matlab command using fsolve():
>> v = fsolve(‘specvol1’,0.2’)
Matlab output using fsolve():
v=1.8159
Table 6.2 Calculation of the specific volume of Benzenethiol using
Redlich- kwong Equation of State having a function file
Contents of the function file:
function y = specvol1l(v)
Tc = 689; % Data from Perry’s Chemical Handbook/2-138 Critical Constants
pc = 4.74; % 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

Matlab command using fzero():


>> v = fzero(‘specvol’,0.2)
Matlab output using fzero():
v=1.8183
Matlab command using fsolve():
>> v = fsolve(‘specvol’,0.2’)
Matlab output using fsolve():
v=1.8183

Table 6.3 Calculation of the specific volume of Benzoic Acid using


Redlich- kwong Equation of State having a function file
Contents of the function file:
function y = specvol1(v)
Tc = 751; % Data from Perry’s Chemical Handbook/2-138 Critical Constants
pc = 4.47; % 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

Matlab command using fzero():


>> v = fzero(‘specvol’,0.2)
Matlab output using fzero():
v=1.9244
Matlab command using fsolve():
>> v = fsolve(‘specvol’,0.2’)
Matlab output using fsolve():
v=1.9244

Table 6.4 Calculation of the specific volume of Benzonitrile Ether using


Redlich- kwong Equation of State having a function file
Contents of the function file:
function y = specvol1(v)
Tc = 699.35; % Data from Perry’s Chemical Handbook/2-138 Critical Constants
pc = 4.215; % 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

Matlab command using fzero():


>> v = fzero(‘specvol’,0.2)
Matlab output using fzero():
v=1.8641
Matlab command using fsolve():
>> v = fsolve(‘specvol’,0.2’)
Matlab output using fsolve():
v=1.8641

Table 6.5 Calculation of the specific volume of Benzophenone using


Redlich- kwong Equation of State having a function file
Contents of the function file:
function y = specvol(v)
Tc = 830; % Data from Perry’s Chemical Handbook/2-138 Critical Constants
pc = 3.352; % 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

Matlab command using fzero():


>> v = fzero(‘specvol’,0.2)
Matlab output using fzero():
v=1.8379
Matlab command using fsolve():
>> v = fsolve(‘specvol’,0.2’)
Matlab output using fsolve():
v=1.8379

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

Preduced Molar Vol

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

Table 7.2 Calculation of the volume of 2 moles of Benzenethiol 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 Sarcon_le06_p7b.m
% filename: Sarcon_le6_p07b.m
clear all
format short e
global press a b R T
% set the constants
Pcrit = 50.43; % in atm
Tcrit = 689.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:
>> Sarcon_le06_p7b
Matlab output:

Preduced Molar Vol

0.0503 0.1486

1.0000 0.1482

2.0000 0.1479

4.0000 0.1473

10.0000 0.1460
20.0000 0.1447

Table 7.3 Calculation of the volume of 2 moles of Benzoic Acid 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 Tacaisan_le06_p7b.m
% filename: Tacaisan_le6_p07b.m
clear all
format short e
global press a b R T
% set the constants
Pcrit = 50.07; % in atm
Tcrit = 741.85; % 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:
>> Tacaisan_le06_p7b
Matlab output:

Preduced Molar Vol

0.0503 0.1564

1.0000 0.1563

2.0000 0.1561

4.0000 0.1558

10.0000 0.1551

20.0000 0.1544

Table 7.4 Calculation of the volume of 2 moles of Benzonitrile 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 Veras_le06_p7b.m
% filename: Veras_le6_p07b.m
clear all
format short e
global press a b R T
% set the constants
Pcrit = 41.6; % in atm
Tcrit = 699.2; % 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_p7b
Matlab output:

Preduced Molar Vol

0.0503 0.1757

1.0000 0.1756

2.0000 0.1754

4.0000 0.1752

10.0000 0.1748

20.0000 0.1742

Table 7.5 Calculation of the volume of 2 moles of Benzophenone 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 Veras_le06_p7b.m
% filename: Veras_le6_p07b.m
clear all
format short e
global press a b R T
% set the constants
Pcrit = 33.08; % in atm
Tcrit = 830; % 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_p7b
Matlab output:

Preduced Molar Vol

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.

9. Assessment (Rubric for Laboratory Performance):


TECHNOLOGICAL INSTITUTE OF THE PHILIPPINES
RUBRIC FOR MODERN TOOL USAGE
(Engineering Programs)
Student Outcome (e): Use the techniques, skills, and modern engineering tools necessary for engineering
practice in complex engineering activities.
Program: Chemical Engineering Course: CHE205 Section: CHE22S1 1st Sem SY 2021-2022
Performance Unsatisfactory Developing Satisfactory Very Satisfactory Score
Indicators 1 2 3 4
1. Apply Fails to identify Identifies Identifies modern Recognizes the
appropriate any modern modern techniques and is benefits and
techniques, techniques to techniques but able to apply constraints of
skills, and perform fails to apply these in modern
modern discipline- these in performing engineering tools
tools to specific performing discipline-specific and shows
perform a engineering discipline- engineering task. intention to apply
discipline- task. specific them for
specific engineering engineering
engineering task. practice.
task.
2. Demonstrat Fails to apply Attempts to Shows ability to Shows ability to
e skills in any modern apply modern apply fundamental apply the most
applying tools to solve tools but has procedures in appropriate and
different engineering difficulties to using modern effective modern
techniques problems. solve tools when solving tools to solve
and modern engineering engineering engineering
tools to problems. problems. problems.
solve
engineering
problems.
3. Recognize Does not Recognizes Recognizes the Recognizes the
the benefits recognize the some benefits benefits and need for benefits
and benefits and and constraints of and constraints of
constraints constraints of constraints of modern modern
of modern modern modern engineering tools engineering tools
engineering engineering engineering and shows and makes good
tools. tools. tools. intention to apply use of them for
them for engineering
engineering practice.
practice.
Total Score
Mean Score = (Total Score / 3)
Percentage Rating = (Total Score / 12) x 100%
Evaluated by: Engr. Crispulo G. Maranan
Printed Name and Signature of Faculty Member Date 11/1/2021

End of Laboratory Exercise 5

You might also like