% This is a simple ode integrator  
% it is set up to be easily modified to use for different dynamics
function  desolver

clear all
global  k1 k2
k1 = 0.139;
k2 = .4;
 

 
tstep = .1;
t_end = 10;
U = 10;
V = 20;
W = 0;


%specify the output points
tspan = [0:tstep:t_end];

s0 = [U;V;W];  %  format s0 = [U;V;...] as a column vector

[T,S] = ode23(@deRHS,tspan, s0, odeset('maxstep',1));  
U = S(:,1);
 V = S(:,2);
 W = S(:,3);
 
%add nullclines if this is a 2-d system
 
 
figure(1)
 
plot(U,V)
 
ylabel('V')
xlabel('U')


p= polyfit(T,log(U),1)

%the right hand side for ode simulation:
function s_prime=deRHS(t,s)
global  k1 k2 
U = s(1);
V = s(2);
W = s(3);

 
Uprime = -k1*U*V +k2*W;
Vprime = -k1*U*V +k2*W;
Wprime = k1*U*V -k2*W;
 
s_prime = [Uprime Vprime Wprime]';  
