## Code for Figure 17

### main.m

```clear('all'); close('all');
%
% Create data for the model discrimination exercise
%
% True model:
%
%       k1
% A     -> 2B
%
%       k2
% 2 B   -> D
%
%       k3
% B + C -> E
%
% jbr,  12/2008

clear all
close all
global theta

k1 = 0.5;
k2 = 100;
k3 = 10;
% k2 = 0.2
% k3 = 0.2;
ca0 = 1;
cb0 = 0;
cc0 = 2;
cd0 = 0;
ce0 = 0;
c0 = [ca0; cb0; cc0; cd0; ce0];

theta = [k1; k2; k3];
tfinal = 15;

measure.states = [1, 3, 4, 5];
measure.time = linspace(0, tfinal, 21)';

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

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

figure(2);
plot(tsolver, conc)
```

### massbal.m

```function xdot = massbal(t, x)
global theta
ca  = x(1);
cb  = x(2);
cc  = x(3);
cd  = x(4);
ce  = x(5);
k1  = theta(1);
k2  = theta(2);
k3  = theta(3);
r1 = k1*ca;
r2 = k2*cb*cb;
r3 = k3*cb*cc;
xdot = [-r1; 2*r1-2*r2-r3; -r3; r2; r3];
```