% MATLAB file used in the solution of the problem from Activity 4.2 of 
% "A First Course on Kinetics and Reaction Engineering."

% Question 1

k = 0.304
T = 30+273 % T must be in K in Arrhenius equation
k0 = k/exp(-61.1*1000/8.3144/T)
k_65 = k0*exp(-61.1*1000/8.3144/(273.15+65))

% Question 2

E = log(2)*8.3144/(1/295-1/318)
k0 = 3.07e-4/exp(-E/8.3144/313)
k = k0*exp(-E/8.3144/305)

% Question 3

% Enter the data from the table and the gas constant
R = 8.3144e-3; % kJ/mol/K
t = [25; 35; 45; 55; 65]
k = [0.8e-3; 3.8e-3; 15.1e-3; 46.7e-3; 151e-3]

% Convert the temperatures to K and calculate the x values
T = t + 273.15;
x = 1./T;

% Calculate the y_hat values
y_hat = log(k);

% 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 the activation energy and its 95% confidence limits
E = -m*R
lambda_E = R*m_u

% Calculate the pre-exponential factor and its 95% confidence limits
k0 = exp(b)
lambda_k0 = b_u*exp(b)

