You are on page 1of 74

Honor Pledge:

I accept responsibility for my role in ensuring the integrity of the work submitted by the group which I
participated.

Group No. _6_

Group Members

1. ________Hatud, Erika_______________

2. ________Hermoso, Danica ________

3. ________Lising, Angela Nicole________

4. ________Loveres, Shania Faith_______

5. ________Lumaban, Genesis__________

Date of Activity _____October 20, 2020_________

Date of Submission _____October 22, 2020_________

Loveres, Shania Faith R. 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. 5
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 CO2 ( 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:CHE 508 Laboratory Exercise No.: 05
Group No.:6 Section: CHE51S1
Group Members: Date Performed:October 20, 2020
HATUD, Erika Date Submitted:October 22,2020
HERMOSO, Danica Instructor: Engr. Crispulo G. Maranan
LISING, Angela Nicole
LOVERES, Shania Faith
LUMABAN, Genesis
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(f, 0.5)
Matlab output:
f =
'cos(x) - 2*x^3'
x =
0.7214

Table 1b. Solution of the non-linear equation , cos (x) – 2x3 = 0, using an m-file
Contents of yourSurname_le06_p1b.m
clc
f = 'cos(x) - 2*x^3'; % suppress the output
x = fzero(f, 0.5)
Matlab Command/s:
>>Group6_le06_p1b
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 yourSurname_le06_p1c.m
clc
x = fzero('myfunction',0.5)
Matlab Command/s:
>>Group6_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 Group6_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:
Group6_le06_p2b.m
Matlab output:

3.4664

6.2869

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=myfunction1 (x)
%x is the input and f is the output
f=2*sin(x)-sqrt(x)+2.5;
end
Contents of Group06_le06_p2c.m
clc;
%plotfplot(‘myfunction’,[0,4*pi])
x1=fzero('myfunction1',3);
x2=fzero('myfunction1',6);
x3=fzero('myfunction1',9);
disp(x1)
disp(x2)
disp(x3)
Matlab Command/s:
Group6_le06_p2c.m
Matlab output:

3.4664

6.2869

9.1585
3. Procedure 3

Table 3. Calculation of the volume of 2 moles of CO 2 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 yourSurname_le06_p3.m
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:

global P T n a b R

R=0.08206;

P=6; T=323.2; n=2; a=3.58; b=0.047;

Vest=n*R*T/P;

V=fzero('Waals', Vest)

Matlab output:

V = 8.6621
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;


Matlab command using fzero():
>>v = fzero('specvol',0.2)
Matlab output using fzero():
v = 2.0374
Matlab command using fsolve():
>>v = fsolve('specvol',0.2)
Matlab output using fsolve():
v = 2.0374
5. Procedure 5
Table 5. Calculation of the volume of 2 moles of CO 2 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 yourSurname_le06_p5b.m
% filename: Group6_le6_p05b.m
clc
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:
>> Group6_le06_p5b
Matlab output:
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 Ethanol using Redich-kwong Equation of State
having a function file

Contents of the function file:


function y = Ethanol(v)
Tc = 514; % Data from Perry1s Chemical Handbook/2-138 Critical
Constants
pc = 6.137; % Data from Perry6s 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 =25;
R = 0.08205;
arK = 0.42748*(R*Tc)^2/pc;
aRK = arK*(Tc/T)^0.5;
bRK = 0.08664*(R*Tc/pc);
y = P*v^3 - R*T*v^2 + (aRK - P*bRK ^2 - R*T*bRK)*v - aRK*bRK;

Matlab command using fzero():

v =fzero('Ethanol',0.2)

Matlab output using fzero():

v =

0.9822

Matlab compound using fsolve():

v =fsolve('Ethanol',0.2)

Matlab output using fsolve():

v =

0.9822
Table 6.2 Calculation of the specific volume of Ethyl acetate using Redich-kwong Equation of State
having a function file

Contents of the function file:


function y = ethylacetate(v)
Tc = 523.3; % Data from Perry1s Chemical Handbook/2-138 Critical
Constants
pc = 3.88; % Data from Perry6s 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 =25;
R = 0.08205;
arK = 0.42748*(R*Tc)^2/pc;
aRK = arK*(Tc/T)^0.5;
bRK = 0.08664*(R*Tc/pc);
y = P*v^3 - R*T*v^2 + (aRK - P*bRK ^2 - R*T*bRK)*v - aRK*bRK;

Matlab command using fzero():

v =fzero('ethylacetate',0.2)

Matlab output using fzero():

v =

1.4409

Matlab compound using fsolve():

v =fsolve('ethylacetate',0.2)

Matlab output using fsolve():

v =

1.4409
Table 6.3 Calculation of the specific volume of Ethyl amine using Redich-kwong Equation of State
having a function file

Contents of the function file:


function y = ethylamine(v)
Tc = 456.15; % Data from Perry1s Chemical Handbook/2-138 Critical
Constants
pc = 5.62; % Data from Perry6s 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 =25;
R = 0.08205;
arK = 0.42748*(R*Tc)^2/pc;
aRK = arK*(Tc/T)^0.5;
bRK = 0.08664*(R*Tc/pc);
y = P*v^3 - R*T*v^2 + (aRK - P*bRK ^2 - R*T*bRK)*v - aRK*bRK;

Matlab command using fzero():

v =fzero('ethylamine',0.2)

Matlab output using fzero():

v =

1.0759

Matlab compound using fsolve():

v =fsolve('ethylamine',0.2)

Matlab output using fsolve():

v =

1.0759
Table 6.4 Calculation of the specific volume of Ethyl benzene using Redich-kwong Equation of State
having a function file

Contents of the function file:


function y = ethylbenzene(v)
Tc = 617.15; % Data from Perry1s Chemical Handbook/2-138 Critical
Constants
pc = 3.609; % Data from Perry6s 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 =25;
R = 0.08205;
arK = 0.42748*(R*Tc)^2/pc;
aRK = arK*(Tc/T)^0.5;
bRK = 0.08664*(R*Tc/pc);
y = P*v^3 - R*T*v^2 + (aRK - P*bRK ^2 - R*T*bRK)*v - aRK*bRK;

Matlab command using fzero():

v =fzero('ethylbenzene',0.2)

Matlab output using fzero():

v =

1.6376

Matlab compound using fsolve():

v =fsolve('ethylbenzene',0.2)

Matlab output using fsolve():

v =

1.6376
Table 6.5 Calculation of the specific volume of Ethyl benzoate using Redich-kwong Equation of
State having a function file

Contents of the function file:


function y = ethylbenzoate(v)
Tc = 698; % Data from Perry1s Chemical Handbook/2-138 Critical
Constants
pc = 3.18; % Data from Perry6s 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 =25;
R = 0.08205;
arK = 0.42748*(R*Tc)^2/pc;
aRK = arK*(Tc/T)^0.5;
bRK = 0.08664*(R*Tc/pc);
y = P*v^3 - R*T*v^2 + (aRK - P*bRK ^2 - R*T*bRK)*v - aRK*bRK;

Matlab command using fzero():

v =fzero('ethylbenzoate',0.2)

Matlab output using fzero():

v =

1.9713

Matlab compound using fsolve():


v =fsolve('ethylbenzoate',0.2)

Matlab output using fsolve():

v =

1.9713
Table 6.6 Calculation of the specific volume of 2-Ethyl Butanoic Acid using Redich-kwong Equation
of State having a function file

Contents of the function file:

function y=EthylButanoicAcid (v)


Tc=600; % Data from Perry's Chemical Handbook/2-138 Critical constants
pc=3.41; % % Data from Perry3s 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^2)*(Tc^2)/pc;
aRK = arK*(Tc/T)^0.5;
bRK = 0.08664*(R*Tc/pc);
y = p*v^3 - R*T*v^2 + (aRK - p*bRK ^2 - R*T*bRK) *v - aRK*bRK;

Matlab command using fzero():

v = fzero('EthylButanoicAcid',0.2)

Matlab output using fzero():


v =

1.7577

Matlab compound using fsolve():

v = fsolve('EthylButanoicAcid', 0.2)

Matlab output using fsolve():

v =

1.7577
Table 6.7 Calculation of the specific volume of Ethyl Butyrate using Redich-kwong Equation of State
having a function file

Contents of the function file:

function y=EthylButyrate (v)


Tc=751; % Data from Perry's Chemical Handbook/2-138 Critical constants
pc=2.95; % % Data from Perry3s 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^2)*(Tc^2)/pc;
aRK = arK*(Tc/T)^0.5;
bRK = 0.08664*(R*Tc/pc);
y = p*v^3 - R*T*v^2 + (aRK - p*bRK ^2 - R*T*bRK) *v - aRK*bRK;

Matlab command using fzero():

v = fzero('EthylButyrate',0.2)

Matlab output using fzero():


v =

2.2587

Matlab compound using fsolve():

v = fsolve('EthylButyrate', 0.2)

Matlab output using fsolve():

v =

2.2587
Table 6.8 Calculation of the specific volume of Ethylcyclohexane using Redich-kwong Equation of
State having a function file

Contents of the function file:

function y=Ethylcyclohexane (v)


Tc=609.15; % Data from Perry's Chemical Handbook/2-138 Critical
constants
pc=3.04; % % Data from Perry3s 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^2)*(Tc^2)/pc;
aRK = arK*(Tc/T)^0.5;
bRK = 0.08664*(R*Tc/pc);
y = p*v^3 - R*T*v^2 + (aRK - p*bRK ^2 - R*T*bRK) *v - aRK*bRK;

Matlab command using fzero():

v = fzero('Ethylcyclohexane', 0.2)

Matlab output using fzero():


v =

1.9616

Matlab compound using fsolve():

v = fsolve('Ethylcyclohexane', 0.2)

Matlab output using fsolve():

v =

1.9616
Table 6.9 Calculation of the specific volume of Ethylcyclopentane using Redich-kwong Equation of
State having a function file

Contents of the function file:

function y=Ethylcyclopentane (v)


Tc=569.5; % Data from Perry's Chemical Handbook/2-138 Critical
constants
pc=3.4; % % Data from Perry3s 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^2)*(Tc^2)/pc;
aRK = arK*(Tc/T)^0.5;
bRK = 0.08664*(R*Tc/pc);
y = p*v^3 - R*T*v^2 + (aRK - p*bRK ^2 - R*T*bRK) *v - aRK*bRK;

Matlab command using fzero():

v = fzero('Ethylcyclopentane', 0.2)

Matlab output using fzero():


v =

1.7310

Matlab compound using fsolve():

v = fsolve('Ethylcyclopentane', 0.2)

Matlab output using fsolve():

v =

1.7310
Table 6.10 Calculation of the specific volume of Ethylene using Redich-kwong Equation of State
having a function file

Contents of the function file:

function y=Ethylene (v)


Tc=282.34; % Data from Perry's Chemical Handbook/2-138 Critical
constants
pc=5.041; % % Data from Perry3s 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^2)*(Tc^2)/pc;
aRK = arK*(Tc/T)^0.5;
bRK = 0.08664*(R*Tc/pc);
y = p*v^3 - R*T*v^2 + (aRK - p*bRK ^2 - R*T*bRK) *v - aRK*bRK;

Matlab command using fzero():

v = fzero('Ethylene', 0.2)

Matlab output using fzero():


v =

2.0524

Matlab compound using fsolve():

v = fsolve('Ethylene', 0.2)

Matlab output using fsolve():

v =

0.2127
Table 6.11 Calculation of the specific volume of Ethylenediamine using Redich-kwong Equation of
State having a function file

Contents of the function file:


%ethylenediamine
function y = ethylenediamine(v)
Tc = 593; % Data from Perrys Chemical Handbook/2-138 Critical
Constants
pc = 6.29; % Data from Perrys 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 =25;
R = 0.08205;
arK = 0.42748*(R*Tc)^2/pc;
aRK = arK*(Tc/T)^0.5;
bRK = 0.08664*(R*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('ethylenediamine',5)

Matlab output using fzero():

v =

0.9764

Matlab compound using fsolve():


v = fsolve('ethylenediamine',5)

Matlab output using fsolve():

v =

0.9764
Table 6.12 Calculation of the specific volume of Ethylene Glycol using Redich-kwong Equation of
State having a function file

Contents of the function file:


%ethyleneglycol
function y = ethyleneglycol(v)
Tc = 720; % Data from Perrys Chemical Handbook/2-138 Critical
Constants
pc = 8.2; % Data from Perrys 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 =25;
R = 0.08205;
arK = 0.42748*(R*Tc)^2/pc;
aRK = arK*(Tc/T)^0.5;
bRK = 0.08664*(R*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('ethyleneglycol',5)

Matlab output using fzero():

v =

0.8202

Matlab compound using fsolve():

>> v = fsolve('ethyleneglycol',5)

Matlab output using fsolve():

v =

0.8202
Table 6.13 Calculation of the specific volume of Ethyleneimine using Redich-kwong Equation of
State having a function file

Contents of the function file:


%ethyleneimine
function y = ethyleneimine(v)
Tc = 537; % Data from Perrys Chemical Handbook/2-138 Critical
Constants
pc = 6.85; % Data from Perrys 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 =25;
R = 0.08205;
arK = 0.42748*(R*Tc)^2/pc;
aRK = arK*(Tc/T)^0.5;
bRK = 0.08664*(R*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('ethyleneimine',5)

Matlab output using fzero():

v =

0.8944

Matlab compound using fsolve():


v = fsolve('ethyleneimine',5)

Matlab output using fsolve():

v =
0.8944
Table 6.14 Calculation of the specific volume of Ethylene Oxide using Redich-kwong Equation of
State having a function file

Contents of the function file:


%ethyleneoxide
function y = ethyleneoxide(v)
Tc = 469.15; % Data from Perrys Chemical Handbook/2-138 Critical
Constants
pc = 7.19; % Data from Perrys 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 =25;
R = 0.08205;
arK = 0.42748*(R*Tc)^2/pc;
aRK = arK*(Tc/T)^0.5;
bRK = 0.08664*(R*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('ethyleneoxide',5)

Matlab output using fzero():

v =

0.8948

Matlab compound using fsolve():


v = fsolve('ethyleneoxide',5)

Matlab output using fsolve():

v =
0.8948
Table 6.15 Calculation of the specific volume of (COMPOUND) using Redich-kwong Equation of
State having a function file

Contents of the function file:


%ethylformate
function y = ethylformate(v)
Tc = 508.4; % Data from Perrys Chemical Handbook/2-138 Critical
Constants
pc = 4.74; % Data from Perrys 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 =25;
R = 0.08205;
arK = 0.42748*(R*Tc)^2/pc;
aRK = arK*(Tc/T)^0.5;
bRK = 0.08664*(R*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('ethylformate',5)

Matlab output using fzero():

v =

1.2132

Matlab compound using fsolve():


v = fsolve('ethylformate',5)

Matlab output using fsolve():

v =

1.2132
Table 6.16 Calculation of the specific volume of 2-Ethyl hexanoic acid using Redich-kwong
Equation of State having a function file

Contents of the function file:


%2ethylhexanoic acid
function y = 2ethylhexanoicacid(v)
Tc = 674.6; % Data from Perrys Chemical Handbook/2-138 Critical
Constants
pc = 2.79; % Data from Perrys 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 =25;
R = 0.08205;
arK = 0.42748*(R*Tc)^2/pc;
aRK = arK*(Tc/T)^0.5;
bRK = 0.08664*(R*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('ethylhexanoicacid',5)

Matlab output using fzero():

v = 2.1787

Matlab compound using fsolve():

v = fsolve('ethylhexanoicacid',5)

Matlab output using fsolve():


v = 2.1787
Table 6.17 Calculation of the specific volume of (COMPOUND) using Redich-kwong Equation of
State having a function file

Contents of the function file:


%ethylhexylether
function y = ethylhexylether(v)
Tc = 583; % Data from Perrys Chemical Handbook/2-138 Critical
Constants
pc = 2.46; % Data from Perrys 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 =25;
R = 0.08205;
arK = 0.42748*(R*Tc)^2/pc;
aRK = arK*(Tc/T)^0.5;
bRK = 0.08664*(R*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('ethylhexylether',5)

Matlab output using fzero():

v = 2.2404

Matlab compound using fsolve():

v = fsolve('ethylhexylether',5)

Matlab output using fsolve():


v = 2.2404
Table 6.18 Calculation of the specific volume of Ethyl isopropyl ether using Redich-kwong Equation
of State having a function file

Contents of the function file:


%ethylisopropylether
function y = ethylhexylether(v)
Tc = 489; % Data from Perrys Chemical Handbook/2-138 Critical
Constants
pc = 3.41; % Data from Perrys 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 =25;
R = 0.08205;
arK = 0.42748*(R*Tc)^2/pc;
aRK = arK*(Tc/T)^0.5;
bRK = 0.08664*(R*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('ethylisopropylether',5)

Matlab output using fzero():

v = 1.5750

Matlab compound using fsolve():

v = fsolve('ethylisopropylether',5)

Matlab output using fsolve():

v = 1.5750
Table 6.19 Calculation of the specific volume of Ethylisopropyl Ketone using Redich-kwong
Equation of State having a function file

Contents of the function file:


%ethylisopropylketone
function y = ethylisopropylketone(v)
Tc = 567; % Data from Perrys Chemical Handbook/2-138 Critical
Constants
pc = 3.32; % Data from Perrys 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 =25;
R = 0.08205;
arK = 0.42748*(R*Tc)^2/pc;
aRK = arK*(Tc/T)^0.5;
bRK = 0.08664*(R*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('ethylisopropylketone',5)

Matlab output using fzero():

v = 1.6960

Matlab compound using fsolve():

v = fsolve('ethylisopropyketone',5)

Matlab output using fsolve():

v =1.6960
Table 6.20 Calculation of the specific volume of Ethyl mercaptan using Redich-kwong Equation of
State having a function file

Contents of the function file:


%ethylmercaptan
function y = ethylisopropylketone(v)
Tc = 499.15; % Data from Perrys Chemical Handbook/2-138 Critical
Constants
pc = 5.49; % Data from Perrys 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 =25;
R = 0.08205;
arK = 0.42748*(R*Tc)^2/pc;
aRK = arK*(Tc/T)^0.5;
bRK = 0.08664*(R*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('ethylmercaptan',5)

Matlab output using fzero():

v = 1.0766

Matlab compound using fsolve():

v = fsolve('ethylmercaptan',5)

Matlab output using fsolve():

v = 1.0766
Table 6.21 Calculation of the specific volume of Ethyl propionate using Redlich-kwong Equation of
State having a function file

Contents of the function file:

function y = EthylPropionate(v)
Tc = 546; % Data from Perry's Chemical Engineering Handbook/2-138
Critical Constants
pc = 33.18; % Data from Perry's Chemical Engineering 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 = 25;
R = 0.08205;
arK = 0.42748*(R*Tc)^2/pc;
aRK = arK*(Tc/T)^0.5;
bRK = 0.08664*(R*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('EthylPropionate’, 0.2)

Matlab output using fzero():


v =

0.2292

Matlab compound using fsolve():


>> v = fsolve('EthylPropionate’, 0.2)

Matlab output using fsolve():


v =

0.2292
Table 6.22 Calculation of the specific volume of Ethylpropyl ether using Redlich-kwong Equation of
State having a function file

Contents of the function file:

function y = EthylpropylEther(v)
Tc = 500.23; % Data from Perry's Chemical Engineering Handbook/2-138
Critical Constants
pc = 33.26; % Data from Perry's Chemical Engineering 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 = 25;
R = 0.08205;
arK = 0.42748*(R*Tc)^2/pc;
aRK = arK*(Tc/T)^0.5;
bRK = 0.08664*(R*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('EthylpropylEther', 0.2)

Matlab output using fzero():


v =

1.0999

Matlab compound using fsolve():


>> v = fsolve('EthylpropylEther', 0.2)

Matlab output using fsolve():


v =

1.0999
Table 6.23 Calculation of the specific volume of Ethyltrichlorosilane using Redlich-kwong Equation
of State having a function file

Contents of the function file:

function y = Ethyltrichlorosilane(v)
Tc = 559.95; % Data from Perry's Chemical Engineering Handbook/2-138
Critical Constants
pc = 32.86; % Data from Perry's Chemical Engineering 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 = 25;
R = 0.08205;
arK = 0.42748*(R*Tc)^2/pc;
aRK = arK*(Tc/T)^0.5;
bRK = 0.08664*(R*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('Ethyltrichlorosilane', 0.2)

Matlab output using fzero():


v =

0.2222

Matlab compound using fsolve():


>> v = fsolve('Ethyltrichlorosilane', 0.2)

Matlab output using fsolve():


v =

0.2222
Table 6.24 Calculation of the specific volume of Fluorine using Redlich-kwong Equation of State
having a function file

Contents of the function file:

function y = Fluorine(v)
Tc = 144.12; % Data from Perry's Chemical Engineering Handbook/2-138
Critical Constants
pc = 51.04; % Data from Perry's Chemical Engineering 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 = 25;
R = 0.08205;
arK = 0.42748*(R*Tc)^2/pc;
aRK = arK*(Tc/T)^0.5;
bRK = 0.08664*(R*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('Fluorine', 0.2)

Matlab output using fzero():


v =

1.6462

Matlab compound using fsolve():


>> v = fsolve('Fluorine', 0.2)

Matlab output using fsolve():


v =

1.6462
Table 6.25 Calculation of the specific volume of Fluorobenzene using Redlich-kwong Equation of
State having a function file

Contents of the function file:

function y = Fluorobenzene(v)
Tc = 560.09; % Data from Perry's Chemical Engineering Handbook/2-138
Critical Constants
pc = 44.91; % Data from Perry's Chemical Engineering 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 = 25;
R = 0.08205;
arK = 0.42748*(R*Tc)^2/pc;
aRK = arK*(Tc/T)^0.5;
bRK = 0.08664*(R*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('Fluorobenzene', 0.2)

Matlab output using fzero():


v =

0.1672

Matlab compound using fsolve():


>> v = fsolve('Fluorobenzene', 0.2)

Matlab output using fsolve():


v =

0.1672
7. Procedure 7
Table 7.1 Calculation of the volume of 2 moles of Ethanol 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 Group6_Ethanol.m
%Filename: Group6_Ethanol.m
clear all
format short e
global press a b R T
% set the constants
Pcrit = 6.137 ; % in atm
Tcrit = 514; % 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:

Group6_Ethanol

Matlab output:
Preduced Molar Vol
5.0314e-02 1.1709e+02
1.0000e+00 1.3931e+00
2.0000e+00 1.2892e+00
4.0000e+00 1.1936e+00
1.0000e+01 1.0817e+00
2.0000e+01 1.0115e+00
Table 7.2 Calculation of the volume of 2 moles of Ethyl acetate 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 Group6_ethylacetate.m
%Filename: Group6_ethylacetate.m
clear all
format short e
global press a b R T
% set the constants
Pcrit = 3.88 ; % in atm
Tcrit = 523.3; % 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:

Group6_ethylacetate

Matlab output:
Preduced Molar Vol
5.0314e-02 1.8503e+02
1.0000e+00 2.1954e+00
2.0000e+00 2.0481e+00
4.0000e+00 1.9054e+00
1.0000e+01 1.7333e+00
2.0000e+01 1.6238e+00
Table 7.3 Calculation of the volume of 2 moles of Ethyl amine 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 Group6_ethylamine.m
%Filename: Group6_ethylamine.m
clear all
format short e
global press a b R T
% set the constants
Pcrit = 5.62 ; % in atm
Tcrit = 456.15; % 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:

Group6_ethylamine

Matlab output:

Preduced Molar Vol


5.0314e-02 1.2855e+02
1.0000e+00 1.8281e+00
2.0000e+00 1.4046e+00
4.0000e+00 1.2378e+00
1.0000e+01 1.0868e+00
2.0000e+01 1.0027e+00
Table 7.4 Calculation of the volume of 2 moles of Ethyl 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;

Contents of Group6_ethylbenzene.m
%Filename: Group6_ethylbenzene.m
clear all
format short e
global press a b R T
% set the constants
Pcrit = 3.609 ; % in atm
Tcrit = 617.15; % 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:

Group6_ethylbenzene

Matlab output:
Preduced Molar Vol
5.0314e-02 1.9680e+02
1.0000e+00 2.4365e+00
2.0000e+00 2.3581e+00
4.0000e+00 2.2584e+00
1.0000e+01 2.1114e+00
2.0000e+01 2.0058e+00
Table 7.5 Calculation of the volume of 2 moles of Ethyl benzoate 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 Group6_ethylbenzoate.m
%Filename: Group6_ethylbenzoate.m
clear all
format short e
global press a b R T
% set the constants
Pcrit = 3.18 ; % in atm
Tcrit = 698; % 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:

Group6_ethylbenzoate

Matlab output:
Preduced Molar Vol
5.0314e-02 2.2085e+02
1.0000e+00 2.9423e+00
2.0000e+00 2.8786e+00
4.0000e+00 2.7893e+00
1.0000e+01 2.6441e+00
2.0000e+01 2.5324e+00
Table 7.6 Calculation of the volume of 2 moles of Ethyl Butanoic 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;

Contents of Group6_EthylButanoicAcid.m

% filename: Group6_EthylButanoicAcid.m
clear all
format short e
global press a b R T
% set the constants
Pcrit = 33.65408 ; % in atm
Tcrit = 655; % 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:

Group6_EthylButanoicAcid
Matlab output:
press =

1.6933e+00

press =

3.3654e+01

press =

6.7308e+01

press =

1.3462e+02

press =

3.3654e+02

press =

6.7308e+02

Preduced Molar Vol


5.0314e-02 2.0999e+01
1.0000e+00 2.6856e-01
2.0000e+00 2.6150e-01
4.0000e+00 2.5204e-01
1.0000e+01 2.3734e-01
2.0000e+01 2.2641e-01
Table 7.7 Calculation of the volume of 2 moles of EthylButyrate 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 Group6_EthylButyrate.m

% filename: Group6_EthylButyrate.m
clear all
format short e
global press a b R T
% set the constants
Pcrit = 29.11424 ; % in atm
Tcrit = 571; % 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:

Group6_EthylButyrate
Matlab output:

press =

1.4649e+00

press =

2.9114e+01

press =

5.8228e+01

press =

1.1646e+02

press =

2.9114e+02

press =

5.8228e+02

Preduced Molar Vol


5.0314e-02 2.4532e+01
1.0000e+00 2.9436e-01
2.0000e+00 2.8150e-01
4.0000e+00 2.6667e-01
1.0000e+01 2.4650e-01
2.0000e+01 2.3275e-01
Table 7.8 Calculation of the volume of 2 moles of Ethylcyclohexane 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 Group6_Ethylcyclohexane.m

% filename: Group6_Ethylcyclohexane.m
clear all
format short e
global press a b R T
% set the constants
Pcrit = 30.00247 ; % in atm
Tcrit = 609.15; % 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:

Group6_Ethylcyclohexane
Matlab output:

press =

1.5096e+00

press =

3.0002e+01

press =

6.0005e+01

press =

1.2001e+02

press =

3.0002e+02

press =

6.0005e+02

Preduced Molar Vol


5.0314e-02 2.3697e+01
1.0000e+00 2.9156e-01
2.0000e+00 2.8172e-01
4.0000e+00 2.6938e-01
1.0000e+01 2.5140e-01
2.0000e+01 2.3860e-01
Table 7.9 Calculation of the volume of 2 moles of Ethylcyclopentane 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 Group6_Ethylcyclopentane.m

% filename: Group6_Ethylcyclopentane.m
clear all
format short e
global press a b R T
% set the constants
Pcrit = 33.5554 ; % in atm
Tcrit = 569.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:

Group6_Ethylcyclopentane
Matlab output:

press =

1.6883e+00

press =

3.3555e+01

press =

6.7111e+01

press =

1.3422e+02

press =

3.3555e+02

press =

6.7111e+02

Preduced Molar Vol


5.0314e-02 2.1288e+01
1.0000e+00 2.5524e-01
2.0000e+00 2.4397e-01
4.0000e+00 2.3101e-01
1.0000e+01 2.1345e-01
2.0000e+01 2.0150e-01
Table 7.10 Calculation of the volume of 2 moles of Ethylene 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 yourSurname_le06_p5b.m

% filename: Group6_Ethylene.m
clear all
format short e
global press a b R T
% set the constants
Pcrit = 49.750802 ; % in atm
Tcrit = 282.34; % 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:

Group6_Ethylene
Matlab output:

press =

2.5032e+00

press =

4.9751e+01

press =

9.9502e+01

press =

1.9900e+02

press =

4.9751e+02

press =

9.9502e+02

Preduced Molar Vol


5.0314e-02 1.4687e+01
1.0000e+00 6.7691e-01
2.0000e+00 3.0925e-01
4.0000e+00 1.5060e-01
1.0000e+01 9.5115e-02
2.0000e+01 7.9812e-02
Table 7.11 Calculation of the volume of 2 moles of Ethylenediamine 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 yourSurname_le06_p5b.m
% filename: Group6_Ethylenediamine.m
clc
format short e
global press a b R T
% set the constants
Pcrit = 6.29 ; % in atm
Tcrit = 593; % 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:

Group6_Ethylenediamine

Matlab output:
Preduced Molar Vol
5.0314e-02 1.1326e+02
1.0000e+00 1.3773e+00
2.0000e+00 1.3258e+00
4.0000e+00 1.2632e+00
1.0000e+01 1.1744e+00
2.0000e+01 1.1123e+00
Table 7.12 Calculation of the volume of 2 moles of Ethylene Glycol 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 yourSurname_le06_p5b.m
% filename: Group6_EthyleneGlycol.m
clc
format short e
global press a b R T
% set the constants
Pcrit = 8.2 ; % in atm
Tcrit = 720; % 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:

Group6_EthyleneGlycol

Matlab output:

Preduced Molar Vol


5.0314e-02 8.5358e+01
1.0000e+00 1.1623e+00
2.0000e+00 1.1392e+00
4.0000e+00 1.1063e+00
1.0000e+01 1.0518e+00
2.0000e+01 1.0092e+00
Table 7.13 Calculation of the volume of 2 moles of Ethyleneimine 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 yourSurname_le06_p5b.m
% filename: Group6_Ethyleneimine.m
clc
format short e
global press a b R T
% set the constants
Pcrit = 6.85 ; % in atm
Tcrit = 537; % 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:

Group6_Ethyleneimine

Matlab output:

Preduced Molar Vol


5.0314e-02 1.0466e+02
1.0000e+00 1.2413e+00
2.0000e+00 1.1689e+00
4.0000e+00 1.0943e+00
1.0000e+01 1.0006e+00
2.0000e+01 9.3967e-01
Table 7.14 Calculation of the volume of 2 moles of Ethylene Oxide 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 yourSurname_le06_p5b.m
% filename: Group6_EthyleneOxide.m
clc
format short e
global press a b R T
% set the constants
Pcrit = 7.19 ; % in atm
Tcrit = 469.15; % 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:

Group6_EthyleneOxide

Matlab output:

Preduced Molar Vol


5.0314e-02 1.0037e+02
1.0000e+00 1.2930e+00
2.0000e+00 1.0927e+00
4.0000e+00 9.7771e-01
1.0000e+01 8.6582e-01
2.0000e+01 8.0159e-01
Table 7.15 Calculation of the volume of 2 moles of Ethylene Formate 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 yourSurname_le06_p5b.m
% filename: Group6_EthyleneFormate.m
clc
format short e
global press a b R T
% set the constants
Pcrit = 4.34 ; % in atm
Tcrit = 598.4; % 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:

Group6_EthyleneFormate

Matlab output:

Preduced Molar Vol


5.0314e-02 1.6403e+02
1.0000e+00 2.0023e+00
2.0000e+00 1.9300e+00
4.0000e+00 1.8412e+00
1.0000e+01 1.7141e+00
2.0000e+01 1.6246e+00
Table 7.16 Calculation of the volume of 2 moles of (2 - Ethyl Hexanoic 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;

Contents of yourSurname_le06_p5b.m
% filename: Group6_2EthylHexanoic Acid.m
clc
format short e
global press a b R T
% set the constants
Pcrit = 2.78 ; % in atm
Tcrit = 674.6; % 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:

Group6_2EthylHexanoicAcid

Matlab output:
Preduced Molar Vol
5.0314e-02 2.5350e+02
1.0000e+00 3.3018e+00
2.0000e+00 3.2227e+00
4.0000e+00 3.1142e+00
1.0000e+01 2.9420e+00
2.0000e+01 2.8118e+00
Table 7.17 Calculation of the volume of 2 moles of Ethyhhexyl Ether 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 yourSurname_le06_p5b.m
% filename: Group6_Ethylhexylether.m
clc
format short e
global press a b R T
% set the constants
Pcrit = 2.46 ; % in atm
Tcrit = 583; % 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:

Group6_Ethylhexylether

Matlab output:
Preduced Molar Vol
5.0314e-02 2.8993e+02
1.0000e+00 3.5029e+00
2.0000e+00 3.3627e+00
4.0000e+00 3.1960e+00
1.0000e+01 2.9640e+00
2.0000e+01 2.8034e+00
Table 7.18 Calculation of the volume of 2 moles of Ethylisopropyl Ether 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 yourSurname_le06_p5b.m
% filename: Group6_Ethylisopropylether.m
clc
format short e
global press a b R T
% set the constants
Pcrit = 3.41 ; % in atm
Tcrit = 489; % 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:

Group6_Ethylisopropylether

Matlab output:
Preduced Molar Vol
5.0314e-02 2.1124e+02
1.0000e+00 2.5740e+00
2.0000e+00 2.3030e+00
4.0000e+00 2.0978e+00
1.0000e+01 1.8788e+00
2.0000e+01 1.7477e+00
Table 7.19 Calculation of the volume of 2 moles of Ethylisopropyl Ketone 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 yourSurname_le06_p5b.m
% filename: Group6_Ethylisopropylketone.m
clc
format short e
global press a b R T
% set the constants
Pcrit = 3.32 ; % in atm
Tcrit = 567; % 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:

Group6_Ethylisopropylketone

Matlab output:
Preduced Molar Vol
5.0314e-02 2.1522e+02
1.0000e+00 2.5773e+00
2.0000e+00 2.4612e+00
4.0000e+00 2.3287e+00
1.0000e+01 2.1501e+00
2.0000e+01 2.0290e+00
Table 7.20 Calculation of the volume of 2 moles of Ethyl mercaptan 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 yourSurname_le06_p5b.m
% filename: Group6_Ethymercaptan.m
clc
format short e
global press a b R T
% set the constants
Pcrit = 5.49 ; % in atm
Tcrit = 499.15; % 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:

Group6_Ethylmercaptan

Matlab output:
Preduced Molar Vol
5.0314e-02 1.3108e+02
1.0000e+00 1.5759e+00
2.0000e+00 1.4336e+00
4.0000e+00 1.3154e+00
1.0000e+01 1.1841e+00
2.0000e+01 1.1039e+00
Table 7.21 Calculation of the volume of 2 moles of Ethyl propionate 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 yourSurname_le06_p5b.m
% filename: Group6_le6_p05b.m
clc
format short e
global press a b R T
% set the constants
Pcrit = 33.18 ; % in atm
Tcrit = 546; % 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:
>> Group6_le06_p5b

Matlab output:
Preduced Molar Vol
5.0314e-02 2.1586e+01
1.0000e+00 2.5644e-01
2.0000e+00 2.4269e-01
4.0000e+00 2.2800e-01
1.0000e+01 2.0913e-01
2.0000e+01 1.9670e-01
Table 7.22 Calculation of the volume of 2 moles of Ethylpropyl ether 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 yourSurname_le06_p5b.m
% filename: Group6_le6_p05b.m
clc
format short e
global press a b R T
% set the constants
Pcrit = 33.26 ; % in atm
Tcrit = 500.23; % 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:
>> Group6_le06_p5b

Matlab output:
Preduced Molar Vol
5.0314e-02 2.1634e+01
1.0000e+00 2.5982e-01
2.0000e+00 2.3670e-01
4.0000e+00 2.1734e-01
1.0000e+01 1.9574e-01
2.0000e+01 1.8253e-01
Table 7.23 Calculation of the volume of 2 moles of Ethyltrichlorosilane 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 yourSurname_le06_p5b.m
% filename: Group6_le6_p05b.m
clc
format short e
global press a b R T
% set the constants
Pcrit = 32.86 ; % in atm
Tcrit = 559.95; % 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:
>> Group6_le06_p5b

Matlab output:
Preduced Molar Vol
5.0314e-02 2.1762e+01
1.0000e+00 2.5977e-01
2.0000e+00 2.4740e-01
4.0000e+00 2.3356e-01
1.0000e+01 2.1520e-01
2.0000e+01 2.0285e-01
Table 7.24 Calculation of the volume of 2 moles of Fluorine 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 yourSurname_le06_p5b.m
% filename: Group6_le6_p05b.m
clc
format short e
global press a b R T
% set the constants
Pcrit = 51.04; % in atm
Tcrit = 144.12; % 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:
>> Group6_le06_p5b

Matlab output:
Preduced Molar Vol
5.0314e-02 1.4377e+01
1.0000e+00 7.2236e-01
2.0000e+00 3.6192e-01
4.0000e+00 1.8389e-01
1.0000e+01 8.3607e-02
2.0000e+01 5.5384e-02
Table 7.25 Calculation of the volume of 2 moles of Fluorobenzene 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 yourSurname_le06_p5b.m
% filename: Group6_le6_p05b.m
clc
format short e
global press a b R T
% set the constants
Pcrit = 44.91; % in atm
Tcrit = 560.09; % 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:
>> Group6_le06_p5b

Matlab output:
Preduced Molar Vol
5.0314e-02 1.5923e+01
1.0000e+00 1.9008e-01
2.0000e+00 1.8104e-01
4.0000e+00 1.7092e-01
1.0000e+01 1.5749e-01
2.0000e+01 1.4846e-01
7. Conclusion:

I therefore conclude that MATLAB is very useful in solving looping equations with specific boundaries and
increments. Other programming languages also have this kind of function with more range but MATLAB is
much easier to use than these programming languages. Calculating the summation of a series of numbers
is possible using Basic loops in MATLAB and it can also do conversions. The looping function of MATLAB is
very useful if the user knows all the commands needed to complete the program.
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: CHE508 Section: CHE51S1 1st Sem SY 2020-2021
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 tools to discipline- these in performing engineering tools
perform a specific performing discipline-specific and shows
discipline- engineering discipline- engineering task. intention to apply
specific task. specific them for
engineering engineering engineering
task. task. practice.
2. Demons Fails to apply Attempts to Shows ability to Shows ability to
trate 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 and problems. solve tools when solving tools to solve
modern tools to engineering engineering engineering
solve problems. problems. problems.
engineering
problems.
3. Recogni Does not Recognizes Recognizes the Recognizes the
ze the benefits recognize the some benefits benefits and need for benefits
and constraints benefits and and constraints of and constraints of
of modern constraints of constraints of modern modern
engineering modern modern engineering tools engineering tools
tools. engineering engineering and shows and makes good
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 October 22, 2020
Printed Name and Signature of Faculty Member Date
End of Laboratory Exercise 5

You might also like