Figure 9.9:

Several replicate data sets, ln k versus 1/T.

Code for Figure 9.9

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
64
65
66
% 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.

%
% Arhenius.m
%
chisq = 5.99;  % chi square value for 95% confidence level with 2 parameters
lnk0  = 1;
E     = 100;
ndata = 10;
Tmin  = 300;
Tmax  = 500;
Tmeas = linspace(Tmin,Tmax,ndata)';
X     = [ones(ndata,1) -1./Tmeas];
lnk   = X*[lnk0; E];
k     = exp(lnk);
measvar= 1e-3;
measstddev = sqrt(measvar);
%
% set seed for 'reproducible' random numbers
%
rng(0);
%
%just a few noisy points
%
nexpts = 500;
clear lnkmeas;
for i = 1:nexpts lnkmeas(:,i) = lnk + measstddev*randn(ndata,1); end
%for i = 1:nexpts kmeas(:,i) = k + measstddev*randn(ndata,1); end
%lnkmeas = log(kmeas);
theta = (inv(X'*X)*X' * lnkmeas)';
%
%center the data first
%
Tcenter = -1./Tmeas + 1/mean(Tmeas);
Xcenter=[ones(ndata,1) Tcenter];
thetacenter = (inv(Xcenter'*Xcenter)*Xcenter' * lnkmeas)';
tmp = [1./Tmeas, lnkmeas(:,1:10)];
save -ascii severaldata.dat tmp;
if (~ strcmp (getenv ('OMIT_PLOTS'), 'true')) % PLOTTING
plot (tmp(:,1), tmp(:,2), '.', ...
       tmp(:,1), tmp(:,3), 'o', ...
       tmp(:,1), tmp(:,4), '+', ...
       tmp(:,1), tmp(:,5), '*', ...
       tmp(:,1), tmp(:,6), 'x', ...
       tmp(:,1), tmp(:,7), 'o', ...
       tmp(:,1), tmp(:,8), '+', ...
       tmp(:,1), tmp(:,9), '*', ...
       tmp(:,1), tmp(:,10), 'x', ...
       tmp(:,1), tmp(:,11), 'o');
% TITLE
end % PLOTTING