Figure 7 (page 15):
The solution to the full model for the series reaction A -> B -> C; ODE model.
Code for Figure 7
Text of the GNU GPL.
main.m
clear('all'); close('all');
% solve full model A->B->C
%
% jbr, 11/26/2007
%
global k1 k2
k1 = 1;
k2 = 10;
x0 = [1; 0; 0];
npts = 150;
tfin = 5;
time = linspace(0, tfin, npts)';
tol = sqrt(eps);
opts = odeset ('AbsTol', tol, 'RelTol', tol);
[tout, x] = ode15s (@rates, time, x0, opts);
plot(tout, x)
table1 = [tout, x];
save ABC_full.dat table1;
rates.m
function dcdt = rates(t, x)
global k1 k2
ca = x(1); cb = x(2); cc = x(3);
r1 = k1*ca; r2 = k2*cb;
dcdt = [-r1; r1-r2; r2];