Sunteți pe pagina 1din 5

Manipal University Jaipur

Department of Chemical Engineering




Introduction to MATLAB

Dr. Manisha Sharma
Assistant Professor

PERFORMED ON: 9/08/19 SUBMITTED BY: Nikunj Khanna

SUBMITTED ON: 14/08/19 179101020

CE1532 Process Modeling and Simulation Lab

Process Modeling and Simulation Lab (CE 1532)


In the previous course “Numerical Methods in Chemical Engineering” you must have learnt
the basics of MATLAB including:
 The MATLAB development environment
 Basic mathematical operations and functions
 Variable naming conventions
 Matrix and array operations
 Basic input and output commands
 The MATLAB Editor, and writing script and function m-files
 Creating 2-D graphs
 Program structures for flow control and repetition

In addition, codes for the following numerical methods were developed:

 Linear Algebraic Equations
o Gauss Elimination
o LU Decomposition
o Gauss Siedel Method
 Non-Linear Algebraic Equations
o Newton – Raphson Technique
 Ordinary Differential Equations
o Runge-Kutta Method
 Function Approximation
 Lagrange’s Interpolation
This lab is a revision of the basics that you have already learnt in the previous course. As a small
exercise, develop a MATLAB code for the following problems using an appropriate numerical method.
Insert appropriate comments whenever required.

Problem 1: Solving a product blending problem

A small food processing company, Monosodium Curtinate Pvt Ltd / SDN BHD, manufactures three
grades (LP, HP and VHP) of a crystalline product that is used as a food additive. The different grades
are distinguished by three product quality parameters: moisture w in g water / kg product, impurity
content x in g solid impurities / kg product and crystal size dp in mm calculated on a mass-weighted-
average basis. The specifications of the three grades are given below.

Product Moisture w Impurity content x Crystal size dp

(g water / kg product) (g impurities / kg product) (mm)
LP 6.0 15 0.6
HP 2.5 5 0.9

Page 1
CE1532 Process Modeling and Simulation Lab

VHP 2.0 2 1.1

As an extra service, MSC offers to blend its standard grades to a customer’s individual specifications
for moisture, impurity content and average crystal size.

(a) Write down equations to determine the masses of LP, HP and VHP grades (mLP, mHP and mVHP)
that would need to be mixed to make batch of mass mB for a customer who ordered a product
with moisture wB, impurity content xB and average crystal size dpB.

𝑤𝑏 (𝑚𝑏 ) = 6𝑚𝐿𝑃 + 2.5𝑚𝐻𝑃 + 2𝑚𝑉𝐻𝑃

𝑥𝑏 (𝑚𝑏 ) = 15𝑚𝐿𝑃 + 5𝑚𝐻𝑃 + 2𝑚𝑉𝐻𝑃
𝑑𝑝𝑏 (𝑚𝑏 ) = 0.6𝑚𝐿𝑃 + 0.9𝑚𝐻𝑃 + 1.1𝑚𝑉𝐻𝑃

(b) Write a Matlab script file (blend.m) to calculate the masses of LP, HP and VHP grades that
need to be mixed together to obtain a blended product of the mass, moisture, impurity level
and average crystal size inputted by the user.

A = input ('Input matrix A');

B = input ('Input matrix B');
X = A\B


Input matrix A[6,2.5,2;15,5,2;.6,.9,1.1]

Input matrix B[250,450,95]
X = 4.5455

(c) What masses of LP, HP and VHP would you need to make 100 kg of blend with a moisture of
2.5 g/kg, impurity content of 4.5 g/kg and average crystal size of 0.95 mm?

𝑚𝐿𝑃 = 4.55𝑘𝑔
𝑚𝐻𝑃 = 63.62𝑘𝑔
𝑚𝑉𝐻𝑃 = 31.81𝑘𝑔

Save blend.m in a convenient place for your future reference.

Problem 2: Flowsheet calculations for a sequence of distillation columns

A sequence of three distillation columns C1 – C3 is used to split a mixture of benzene, toluene,
ethylbenzene and styrene into relatively pure components.

Page 2
CE1532 Process Modeling and Simulation Lab

D2 D3

F D1 B1
C1 C2 C3

B2 B3

The compositions of the feed stream (F) and the four product streams (D2, B2, D3 and B3) are known
and given are in the table below. The feed stream molar flowrate is 100 kgmol/h.

Composition F D2 B2 D3 B3
(mole fraction)
Benzene 0.400 0.980 0.030 0.000 0.000
Toluene 0.250 0.020 0.929 0.031 0.000
Ethylbenzene 0.300 0.000 0.041 0.931 0.037
Styrene 0.050 0.000 0.000 0.038 0.963

(a) Write down a set of equations, or a clearly defined matrix equation, that would allow you to
calculate the molar flowrates of the four product streams (D2, B2, D3 and B3). What is the key
principle you used to develop the equations?

Mass Balance
For Benzene:-
40 = 0.98𝐷2 + 0.03𝐵2
For Toluene:-
25 = 0.02𝐷2 + 0.929𝐵2 + 0.031𝐷3
For Ethyl Benzene:-
30 = 0.041𝐵2 + 0.931𝐷3 + 0.037𝐵3
For Styrene:-
5 = 0.038𝐷3 + 0.963𝐵3

(b) Write a Matlab script file (columns.m) to calculate the molar flowrates of D2, B2, D3 and B3.
What were the flowrates?

A = input ('Input matrix A obtained from mass balance');

B = input ('Input matrix B obtained from mass balance');
X = A\B


Page 3
CE1532 Process Modeling and Simulation Lab

Input matrix A obtained from mass

Input matrix B obtained from mass balance[40;25;30;5]
X = 40.0506


𝐷2 = 40.0506 mol/hr
𝐵2 = 25.0152 mol/hr
𝐷3 = 30.9640 mol/hr
𝐵3 = 3.9703 mol/hr

(c) Indicate how you checked your calculation results.

By Gauss Elimination

Save columns.m in a convenient place for your future reference.

Page 4