% Oxidation of NO to NO2.
% Atkins and Jones, second edition, pp. 720-721. 

global k11 k12 k21 k22 

T=1;   % stop time

% rate constants 
k11=10;  % fast
k12=10;  % fast
k21=.01; % slow
% k22=.0001;  % slow
k22=0;  % slow

% initial values 
u0=[.5; 1; 0; 0];

% [t,U]=ode23('no2', [0, T], u0);            % matlab standard solver
% [t,U]=ode45('no2', [0, T], u0);            % matlab standard solver
% [t,U]=ode15s('no2', [0, T], u0);           % matlab solver - stiff problems
% [t,U]=ode_cg1('no2', [0, T], u0, .001);    % my solver midpoint - adaptive
[t,U]=my_ode('no2', [0, T], u0, .01);      % my solver forward Euler

figure(1)
clf
plot(t,U)

k=2*k11*k21/k12;  % overall rate constant
x=no2a(U)/k;      % this should be = 1 

hold on 

plot(t,x,'k.')

axis([0 t(length(t)) 0 7])
