# IGEM:Stanford/2009/Project Homeostasis/Modeling/trp

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%   This file is part of Stanford iGEM team product, 2009               %
%                                                                       %
%   Copyright (C) YANG He     yanghemary@gmail.com                      %
%                                                                       %
%   \$File: SiGEM_enzyme.ido.m\$     \$Revision:  1\$                       %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%Editted by Chris VanLang 7/13/09

clear all;

% Constants Definition
km1=0.009;
km2=0.1;
e0=0.01;
i0=1;
s0=1;
k2=0.01;
k4=0.001;

% declare initial conditions
y0=[i0 s0 0 0];

% Timing
length=60;
timespan=0.01;
n=length/timespan;

tspan=[0,200000];

%Solving the ODE
[t,y]=ode45(@IDO,tspan,y0,[]);

% Calculation
%s(1)=s0;
%i(1)=i0;
%t=timespan:timespan:length;

%for k=2:n
%    es(k)=e0*s(k-1)/(s(k-1)+km1/km2*i(k-1)+km1);
%    ds=-(es(k)-es(k-1))-k2*es(k);
%    s(k)=s(k-1)+ds*timespan;
%    ei(k)=es(k)*km1/km2*s(k-1)/i(k-1);
%    di=-(ei(k)-ei(k-1))-k4*ei(k);
%    i(k)=i(k-1)+ds*timespan;
%end;

% Graph
%plot(t,es,'r',t,ei,'b',t,s,'k',t,i,'y');
%plot(t,y(1),'r',t,y(2),'b',t,y(3),'k',t,y(4),'y');
plot(t,y)