function sr_rate_O_O2 % Convergence of the Simpson's rule integration for the O-O2 dissociation clc format long e temp=6000; kt=0.8617e-04*temp; yzero=14.5/kt; zmax=20; for n=20:20:400 z=linspace(0,zmax,n+1); [sig]=sigma_O_O2((z+yzero)*kt); f1=1e12*z.*exp(-z).*sig; f2=1e12*exp(-z).*sig; rate1=(z(2)-z(1))/3*(f1(1)+4*sum(f1(2:2:n))+2*sum(f1(3:2:n-1))+f1(n+1)); rate2=(z(2)-z(1))/3*(f2(1)+4*sum(f2(2:2:n))+2*sum(f2(3:2:n-1))+f2(n+1)); rate=exp(-yzero)*rate1+yzero*exp(-yzero)*rate2; fprintf('%i %12.6f\n',n,rate) end function [sig]=sigma_O_O2(e) n=length(e); for i=1:n sig(i)=4.51*(e(i)-14.5)^1.03/(0.21+e(i)^1.31); end