MATLAB_Introduction
MATLAB_Introduction
Example-01: To determine the zero of a function using Bisection algorithm between the range
[ -4 -2.8].
=
f ( x) exp( x) − tan( x)
### function file to make use of fsolve of MATALB inbuilt function to determine the zeros of function
Example-02: Description: Plug Flow Reactor
Concentration along a PFR is given by:
dC 1
= − C1.25 with C (0) = 1
dV 2
Solve to find ‘C’ for reactor volumes range of 1 to 10 liters
(Hint: Use MATLAB in-built function – ODE45)
Example-03: The transient response of a completely mixed reactor with five components can
be modelled as
dC1 dC2
=
−0.12C1 + 0.02C2 + 1; = 0.15C1 − 0.15C2
dt dt
dC3 dC4
=
0.025C2 − 0.225C3 + 4; = 0.1C3 − 0.1375C4 + 0.025C5
dt dt
dC5
= 0.03C1 + 0.01C2 − 0.04C5
dt
Suppose that at t=0 all the concentrations in the reactors are at zero. Write a MATLAB script
to compute how their concentrations will change over the next 250 seconds. Plot the time
versus concentration profile. (Hint: Use MATLAB in-built function – ODE45)
### function file to calculate steady state values… using fsolve of MATALB inbuilt function
dx A q
=
dt V
( x A,in − x A ) − k1.x A 2 + k2 .x A .xB
x A,in = 0.5
x A + xB =
1
f1 ( y1 , y2 ) = 2 x1 − x2 − exp(− x1 )
f 2 ( y1 , y2 ) =− x1 + 2 x2 − exp(− x2 )
Ex-03:
Problem 2: Determine the steady-state, T and Te using Matlab function ‘fsolve’.
dT w hA
= (Ti − T ) + e e (Te − T )
dt m mC
dTe Q he Ae
= − (Te − T )
dt meCe me Ce
Ex-04:
Continuous Fermentor: Evaluate the steady state value of X,S and P product concentration
of the fermentor