% MATLAB file used in the solution of Example 9.4 of "A First Course on
% Kinetics and Reaction Engineering."

% Enter the data from the table
CS = [0.1
0.0856
0.0796
0.0747
0.0695
0.0629
0.0555
0.0482
0.0470
0.0412
0.0364
0.0302
0.0247
0.0209
0.0151
0.0102];

rP = [0.0009206
0.0009217
0.0009225
0.0009182
0.0009204
0.0009170
0.0009173
0.0009150
0.0009169
0.0009165
0.0009144
0.0009105
0.0009044
0.0009009
0.0008911
0.0008782];

% Calculate the x and y_hat values
x = 1./CS;
y_hat = 1./rP;

% Use the MATLAB script file "FitLinmbSR.m" from "A First Course on
% Kinetics and Reaction Engineering" to fit a straight line with slope and
% intercept to the data
FitLinmbSR

% Calculate Vmax and its 95% confidence limits
Vmax = 1/b
lambda_Vmax = b_u/b^2

% Calculate Km and its 95% confidence limits
Km = m*Vmax
lambda_Km = sqrt(m_u^2/b^2 + (m*b_u/b^2)^2)