% Author: Housam Binous
% Non-linear fitting of the Michaelis-Menten model
% National Institute of Applied Sciences and Technology, Tunis, TUNISIA
% Email: binoushousam@yahoo.com
global time CS
x0=0.027;
[t y]=ode45(@rate1,[0 5],x0)
plot(t,y)
% values of substarte concentration versus time given in Fundamentals
% of Chemical Reaction Engineering by Davis & Davis, McGraw Hill 2003
time=[0.0 0.25 0.50 0.75 1.0 1.25 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0];
CS=[0.027 0.024003 0.021006 0.018009 0.015012 ...
0.012501 0.010098 0.005697 0.003213 0.001404 ...
0.000594 0.000243 0.000108 0.000041];
hold on
plot(time, CS,'r*')
clear rmax Km y t
% performing the nonlinear fiting using fminsearch
X0=[1.3e-2,6.5e-3];
options = optimset('TolFun',1e-20);
[xsol fsol]=fminsearch(@sumsquares,X0,options)
% plotting experimental data and fitted values in the same figure
figure(2)
[t y]=ode45(@rate2,[0 5],x0,[],xsol)
plot(t,y)
hold on
plot(time, CS,'r*')