MATAL Tutorial Sheet- Problem and solution
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)
%%% Function file
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
### Dynamic file to get transient response
(3) Description: Solution of the CSTR
k1 = 0.5 k2 = 0.2 q = 1.0 m3/s V=1.0 m3
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
Suppose that at t=0 composition of ‘A’ in the reactor
is x A = 1 . Plot the graph of time vs composition (xA).
Compute how composition will change over the next 5 seconds (Hint: Use MATLAB in-
built function – ODE45)
Additional problem:
Solve nonlinear algebraic equation of the form F(x) =0 using ‘fsolve’ of MATLAB function
Ex-01: Find the valve of ‘c’ for which f( c) = 0
g×m
f (=
c) × (1 − exp(−0.1468 × c)) − 40
c
Ex-02: Find the valve of ‘x1 and x2 for which f( y1,y2) =0
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
=meCe 20= kcal / O C ; mC 200 kcal / oC ;
m m C
= 10 min = .; e e 1.0 = min .; Q 5000 kcal / min .
w he Ae
= =
he Ae 20 kcal / oC min .; Ti 100 oC
Ex-04:
Continuous Fermentor: Evaluate the steady state value of X,S and P product concentration
of the fermentor
Operating Conditions and Model Parameters are as follows:
= g / g ;β 0.2
YX / S 0.4 = = h −1 ; Pm 50 =
g / L ;K i 22 g / L
=D 0.202= h ;α 2.2
−1
= g / g ;µm 0.48= h −1 ; K m 1.2 g / L
S f = 20 g / L