% Supplementary Matlab files for the paper:
%
% " Deterministic Modelling and Stochastic Simulation of Pathways using Matlab"
% by M.Ullah, H.Schmidt, K-H.Cho and O.Wolkenhauer
%
% This script file performs stochastic simulation of the enzymatic example. 
%
% We would appreciate a citation if these files are used by others.

lotka_voltera_data;                                   % Load parameters

[ts,ns] = stoch(n0,c,D,L,tf);                   % Stochastic simulation

Vh = gma(D,c,L);                                % construct ODEs
options = odeset('refine',16);
[t,x] = ode15s(Vh,[0 tf],n0,options);           % solve of ODEs

fig = figure('PaperPosition',[2 2 8 6.3],'PaperType','A4');
 
ax = axes('FontSize',8,'Position',[0.1264 0.15 0.7879 0.7643],'Parent',fig);

h(1:2) = stairs(ax,ts,ns.');
hold on
h(3:4) = plot(ax,t,x);
hold off

set(h,{'Color'},{'b';'r';'c';'m'});
% 
xlabel(ax,'time (sec)');
ylabel(ax,'population');
% legend(h,{'\#S','\# P','[ S ]  (nM)','[ P ]  (nM)'},'FontName','Times','FontSize',8);
% legend boxoff
% ylim(ax(1),[0 1.1*max(n0)])
% ylim(ax(2),[0 1.1*max(x0)])

% print  -depsc 'figures\enzkin_stoch.eps'