Figure 9.20:

Uncertainty in activation energy E and rate constant ln k_m versus number of replicated experiments.

Code for Figure 9.20

Text of the GNU GPL.

main.m


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
% Copyright (C) 2001, James B. Rawlings and John G. Ekerdt
%
% This program is free software; you can redistribute it and/or
% modify it under the terms of the GNU General Public License as
% published by the Free Software Foundation; either version 2, or (at
% your option) any later version.
%
% This program is distributed in the hope that it will be useful, but
% WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
% General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program; see the file COPYING.  If not, write to
% the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
% MA 02111-1307, USA.

alpha = 0.95;
p     = 2;
chisq = chi2inv(alpha, p);
lnk0  = 1;
E     = 100;
Tmin  = 300;
Tmax  = 500;
nTvals = 10;
n0 = 1;
Tmeas = linspace(Tmin, Tmax, nTvals)';
S = eye(2);
%meanT = 1/(0.5*(1/Tmin+1/Tmax));
meanT = mean(Tmeas);
sets = [1; 2; 5; 100];
nsets = length(sets);
measvar = 1e-3;
measstddev = sqrt(measvar);

for i = 1:nsets
    %
    % stack Tmeas on top of itself sets(i) times
    %
    Tmeasset = kron(ones(sets(i),1), Tmeas);
    ndata = size(Tmeasset,1);
    Tcenter = -1./Tmeasset + 1/meanT;
    X = [ones(ndata,1) Tcenter];
    amat = S*X'*X*S/measvar;
    level = chisq;
    %
    % 95% confidence ellipse
    %
    [x, y] = ellipse (amat, level, 150);
    idx = (i-1)*2+1;
    table(:,idx:idx+1) = [x y];

end

save -ascii replicate.dat table;

if (~ strcmp (getenv ('OMIT_PLOTS'), 'true')) % PLOTTING
    plot (table(:,1), table(:,2), ...
          table(:,3), table(:,4), ...
          table(:,5), table(:,6), ...
          table(:,7), table(:,8));
    % TITLE
end % PLOTTING