You are on page 1of 2

Example 4-9

type LEP_4_9

% "LEP_4_9"
% m-file to solve example 4-9
%
% x(1)=ca
% x(2)=cb
% x(3)=cc
% x(4)=cd
% xdot(1)=d(ca)/dt, xdot(2)=d(cb)/dt, xdot(3)=d(cc)/dt, xdot(4)=d(cd)/dt

function xdot=LEP_4_9(t,x)

v0=5;
v00=0.05;
v=v0+v00*t;
k=2.2;
cb0=0.025;
rate=k*x(1)*x(2);
ca0=0.05;

xdot(1,:)=-k*x(1)*x(2)-v00*x(1)/v;
xdot(2,:)=-k*x(1)*x(2)+v00*(cb0-x(2))/v;
xdot(3,:)=k*x(1)*x(2)-v00*x(3)/v;
xdot(4,:)=k*x(1)*x(2)-v00*x(4)/v;

ic=[0.05;0;0;0];tspan=[0 500];
[t,x]=ode45('LEP_4_9',tspan,ic);

plot(t,x);title('Example 4-9');xlabel('time(sec)');
ylabel('ca,cb,cc,cd');
Example 4.11
0.05

0.045

0.04

0.035

0.03
ca,cb,cc,cd

0.025

0.02

0.015

0.01

0.005

0
0 50 100 150 200 250 300 350 400 450 500
time(sec)

You might also like