119Introduction to Kinetics and Chemical Reactors
% fitting the data to a polynomial of power n_p
n_p = 6 ; % choose power of polynomial
fit_well = 1 ; % 0 - enter initial value 0
% 1 - change to 1 after the choice of polynomial fits the
data well
% CALCULATIONS
%_________________________________________________________________
vec_size = size(ca_t_data) ;
n = vec_size(1,1) ;% number of readings
for i = 1:n
t_val = ca_t_data(i,1) ;
Ca_val = ca_t_data(i,2) ;
Ca(i) = Ca_val ;
t(i) = t_val ;
end ;
% fitting the data to a polynomial of power n_p
xlabel_s = ′t - time′ ;
ylabel_s = ′Ca - Kgmoles/m3′ ;
coef_vec = polynom_plot(ca_t_data,n_p,xlabel_s,ylabel_s) ;
if fit_well == 1
% Calculation of half life periods for different values of Ca
nh = 10 ; % number of concentrations ...