Figure A.9 (page 658):

Measurements of species concentrations in Reactions A.9 versus time.

Code for Figure A.9

Text of the GNU GPL.

main.m

%%
%% Create data for the A->B->C model
%% jbr,  11/2008

clear all
close all
global theta

k1 = 2;
k2 = 1;
ca0 = 1;
cb0 = 0;
cc0 = 0;
c0 = [ca0; cb0; cc0];
theta = [k1; k2];
tfinal = 5;
nplot = 100;



measure.states = [1,2,3];
measure.time = linspace(0, tfinal, 20)';

%%create the measurements by solving the model and adding noise
[tsolver, cabc] = ode15s(@massbal, measure.time, c0);
randn('seed',0);
y  = cabc(:,measure.states);
measure.data = y + 0.02*randn(size(y));
myfile = fopen('ABC_data.dat', 'w');
for i = 1: size(y,1)
  fprintf(myfile, '%8.3f', measure.time(i), measure.data(i,:));
  fprintf(myfile, '\n');
end
%fprintf(myfile, '%8.2f %8.3f %8.3f %8.3f \n', [measure.time, measure.data]');
fclose(myfile);

figure(1);
plot(measure.time, measure.data, '-o')


massbal.m

function xdot = massbal(t, x)
  global theta
  ca  = x(1);
  cb  = x(2);
  cc  = x(3);
  k1  = theta(1);
  k2  = theta(2);
  r1 = k1*ca;
  r2 = k2*cb;
  xdot = [-r1; r1-r2; r2];

Data files

ABC_data.dat

   0.000   0.957  -0.031  -0.015
   0.263   0.557   0.330   0.044
   0.526   0.342   0.512   0.156
   0.789   0.224   0.499   0.310
   1.053   0.123   0.428   0.454
   1.316   0.079   0.396   0.556
   1.579   0.035   0.303   0.651
   1.842   0.029   0.287   0.658
   2.105   0.025   0.221   0.750
   2.368   0.017   0.148   0.854
   2.632  -0.002   0.182   0.845
   2.895   0.009   0.116   0.893
   3.158  -0.023   0.079   0.942
   3.421   0.006   0.078   0.899
   3.684   0.016   0.059   0.942
   3.947   0.014   0.036   0.991
   4.211  -0.009   0.014   0.988
   4.474  -0.030   0.036   0.941
   4.737   0.004   0.036   0.971
   5.000  -0.024   0.028   0.985