You are on page 1of 6

Title: MATLAB Applications in Chemical Engineering

Author: Chyi-Tsong Chen (), Ph.D.


Professor of Chemical Engineering Department
Feng Chia University, Taichung, Taiwan
; Email: ctchen@fcu.edu.tw
Publisher: Tung Hua Book Co., Ltd. ()
ISBN: 978-957-483-769-4

Features of the book


This book addresses the applications of MATLAB and
Simulink in the solution of chemical engineering problems.
By classifying the problems into seven different categories,
the author organizes this book as follows:
Chapter One - Solution of a System of Linear Equations
Chapter Two - Solution of Nonlinear Equations
Chapter Three - InterpolationDifferentiation and Integration
Chapter Four - Numerical Solution of Ordinary Differential
Equations
Chapter Five - Numerical Solution of Partial Differential
Equations
Chapter Six - Process Optimization
Chapter Seven - Parameter Estimation
Each chapter is arranged in four major parts. In the first part,
the basic problem patterns that can be solved with MATLAB
are presented. The second part describes how to apply
MATLAB commands to solve the formulated problems in
the field of chemical engineering. In the third and the fourth
parts, exercises and summary of MATLAB instructions are
provided, respectively. The description of the chemical
engineering example follows the sequence of problem
formulation, model analysis, MATLAB program design,
execution results, and discussion. In this way, learners are
first aware of the basic problem patterns and the underlying
chemical engineering principles, followed by further
familiarizing themselves with the relevant MATLAB
instructions and programming skills. Readers are encouraged
to do exercises to practice their problem-solving skills and
deepen the fundamental knowledge of chemical engineering
and relevant application problems.

Contents
Chapter 1: Solution of a System of Linear Equations ......................... 1
1.1

Properties of linear equation systems and the relevant MATLAB


commands ................................................................................................ 1
1.1.1 A simple example: the liquid blending problem ..................................... 1
1.1.2 Relevant properties of linear equation systems ....................................... 3
1.1.3 Relevant MATLAB commands .............................................................. 5

1.2

Chemical engineering examples ............................................................. 10


Example 1-2-1
Example 1-2-2
Example 1-2-3
Example 1-2-4
Example 1-2-5
Example 1-2-6

Composition analysis of a distillation column system ..........................


Temperature analysis of an insulated stainless steel pipeline ..................
Composition analysis of a set of CSTRs ..........................................
Independent reactions in a reaction system ......................................
Composition distributions in a distillation column .............................
Steady-state analysis of a batch reaction system ....................................

10
14
17
21
23
33

1.3

Exercises ................................................................................................. 40

1.4

Summary of the MATLAB commands related to this chapter ............... 46

Chapter 2: Solution of Nonlinear Equations .......................................... 49


2.1

Relevant MATLAB commands and the Simulink solution interface ..... 49


2.1.1 Nonlinear equation of a single variable ................................................ 49
2.1.2 Solution of a system of nonlinear equations ......................................... 59

2.2

Chemical engineering examples ............................................................. 68


Example 2-2-1
Example 2-2-2
Example 2-2-3
Example 2-2-4
Example 2-2-5
Example 2-2-6

Boiling point of an ideal solution .................................................. 68


Equilibrium concentrations in a reaction system ................................ 71
Analysis of a pipeline network ..................................................... 76
A material drying process through heat conduction and forced convection 79
Simulation of a multistage binary distillation .................................... 83
Analysis of a set of three CSTRs in series ........................................ 94

2.3

Exercises ................................................................................................. 97

2.4

Summary of MATLAB commands related to this chapter ................... 115

Chapter 3: Interpolation, Differentiation, and Integration ............. 119


3.1

Interpolation commands in MATLAB .................................................. 119


3.1.1

One-dimensional interpolation ........................................................... 119

3.1.2 Two-dimensional interpolation ........................................................... 122

3.2

Numerical differentiation ..................................................................... 125


3.2.1

The application of the MATLAB diff command in numerical differentiation


............................................................................................................

126

3.2.2 Polynomial fitting and its application to the calculation of derivatives of a


data set ................................................................................................ 127
3.2.3 Higher-order derivatives of a data set ................................................. 128
3.2.4 The derivatives calculation of a known function ................................ 138
3.2.5

A method for calculating numerical gradients .................................... 143

3.3

Numerical integration ........................................................................... 144


3.3.1 Integral of numerical data ................................................................... 144
3.3.2 Integral of a known function ............................................................... 145
3.3.3 Double integral ................................................................................... 147

3.4

Chemical engineering examples ........................................................... 149


Example 3-4-1
Example 3-4-2
Example 3-4-3
Example 3-4-4
Example 3-4-5
Example 3-4-6
Example 3-4-7
Example 3-4-8

Preparation of a water solution with a required viscosity ...................


Interpolation of diffusivity coefficients .........................................
Reaction rate equation of a batch reactor ......................................
Volume fraction of solid particles in a gas-solid fluidized bed ..............
Average residence time calculation based on a tracer response ............
Design of an absorption tower ...................................................
Reaction time of an adiabatic batch reactor ...................................
Breakthrough time determination for an absorption tower .................

149
151
153
158
161
163
166
169

3.5

Exercises ............................................................................................... 173

3.6

Summary of the MATLAB commands related to this chapter ............. 185

Chapter 4: Numerical Solution of Ordinary Differential Equations


............................................................................................................

4.1

187

Initial value problems for ordinary differential equations .................... 187


4.1.1 The standard problems ........................................................................ 187
4.1.2 The MATLAB ODE solvers ............................................................... 188
4.1.3 Solving ODEs with MATLAB Simulink ............................................ 194
4.1.4 The DEE solution interface ................................................................ 208

4.2

Higher-order ordinary differential equations ........................................ 212

4.3

Stiff differential equations .................................................................... 217

4.4

Differential-algebraic equation system ................................................. 222

4.5

Boundary-valued ordinary differential equations ................................. 226


4.5.1 Problem patterns ................................................................................. 226

4.6

4.5.2

MATLAB commands for solving two-point boundary value problems 227

4.5.3

Multipoint BVP .................................................................................. 237

Chemical engineering examples ........................................................... 242


Example 4-6-1 Temperature and conversion distributions in a catalyzed tubular reactor 242
Example 4-6-2 Temperature and conversion distribution in a plug-flow reactor .......... 248
Example 4-6-3 Biochemical process dynamics in a batch reactor ............................. 252
Example 4-6-4 Temperature distribution on a flat panel with heat conduction and radiation ..
255
Example 4-6-5 Flow dynamics of a non-Newtonian fluid ...................................... 259
Example 4-6-6 Optimal operation temperature for penicillin fermentation ............... 264

4.7

Exercises ............................................................................................... 270

4.8

Summary of the MATLAB commands related to this chapter ............. 293

Chapter 5: Numerical Solution of Partial Differential Equations


............................................................................................................

295

5.1

Classifications of PDEs .......................................................................... 295


5.1.1 The order of a PDE ............................................................................. 295
5.1.2 Nonlinearity of a PDE ........................................................................ 296
5.1.3 Categories of initial conditions and boundary conditions ................... 297

5.2

The MATLAB PDE toolbox ................................................................. 300


5.2.1 The MATLAB PDE solver ................................................................. 300
5.2.2 The PDE graphical interface toolbox .................................................. 314
5.2.2.1 The solvable PDE problem patterns ....................................................... 316
5.2.2.2 Solution of PDE problems with the pdetool interface .................................. 318

5.3

Chemical engineering examples ........................................................... 325


Example 5-3-1
Example 5-3-2
Example 5-3-3
Example 5-3-4
Example 5-3-5
Example 5-3-6
Example 5-3-7
Example 5-3-8

Temperature and reaction rate distributions in a catalyzed reactor ........


Concentration distribution in a diffusive reaction system ...................
Rapid cooling of a hot solid object ..............................................
Two-dimensional heat transfer ...................................................
The permeation of gaseous solute into a liquid film .........................
Concentration distribution of ethanol in a tube ..............................
Heat conduction of a long rod ...................................................
Unsteady-state heat conduction in a flat panel ................................

325
333
339
344
355
360
362
366

5.4

Exercises ............................................................................................... 370

5.5

Summary of the MATLAB commands related to this chapter ............. 378

Chapter 6: Process Optimization ............................................................... 381


6.1

The optimization problem and the relevant MATLAB commands ...... 381
6.1.1 Optimization problems of a single decision variable .......................... 381
6.1.2 Multivariate optimization problems without constraints .................... 383
6.1.3 Linear programming problems ........................................................... 386
6.1.4 Quadratic programming problem ........................................................ 388
6.1.5 The constrained nonlinear optimization problems .............................. 391
6.1.6 The multi-objective goal attainment problem ..................................... 395
6.1.7 Semi-infinitely constrained optimization problem ............................. 399
6.1.8 The minimax problem ......................................................................... 408
6.1.9

Binary integer programming problem ................................................ 411

6.1.10 A real-coded genetic algorithm for optimization ................................ 413


6.1.10.1 Fundamental principles of the real-coded genetic algorithm ......................... 413
6.1.10.2 Application of the real-coded genetic algorithm to solve optimization problems . 417

6.2

Chemical engineering examples ........................................................... 427


Example 6-2-1 Maximizing the profit of a production system ................................
Example 6-2-2 The optimal photoresist film thickness in a wafer production process ...
Example 6-2-3 Minimal energy of a chemical equilibrium system ...........................
Example 6-2-4 Maximal profit of an alkylation process ........................................
Example 6-2-5 Maximum separation efficiency in a single-effect distillatory ..............
Example 6-2-6 Dynamic optimization of an ammonia synthesis process ....................
Example 6-2-7 Optimal operating temperature for a tubular reactor .......................

427
431
432
435
441
445
451

6.3

Exercises ............................................................................................... 456

6.4

Summary of the MATLAB commands related to this chapter ............. 477

Chapter 7: Parameter Estimation ............................................................. 479


7.1

Parameter estimation using the least-squares method .......................... 479


7.1.1 Linear least-squares method ............................................................... 480
7.1.2

Nonlinear least-squares methods ........................................................ 486

7.1.3 The confidence interval of parameter estimation ................................ 490

7.2

Chemical engineering examples ........................................................... 493


Example 7-2-1
Example 7-2-2
Example 7-2-3
Example 7-2-4
Example 7-2-5
Example 7-2-6
Example 7-2-7

The solubility model of sulfur dioxide ........................................... 493


The rate equation of a catalyzed reaction system ............................. 495
Isothermal adsorption model for activated carbon ........................... 499
Transfer function of a heating process .......................................... 502
Estimation of the reaction rate constants for a fermentation process ..... 506
Parameter estimation for a packed bed reactor described by a partial
differential equation model ...................................................... 510
Parameter estimation using D-optimal experimental design method ..... 518

7.3

Exercises ............................................................................................... 522

7.4

Summary of the MATLAB commands related to this chapter ............. 533

References ................................................................................................................ 535


Index ........................................................................................................................... 541

You might also like