%ODEs for inducible expression LacI-IPTG system
function dCdt=concentrationsODE(t,y)

global k1 k2 k3 k4 km d1 d2 n;

% k1 On rate for formation of IPTG-LacI complex
% k2 Off rate for formation of IPTG-LacI complex
% k3 Constitutive expression of LacI
% k4 Rate of transcription of GFP - modulated by LacI binding
% km binding constant LacI to promoter
% d1 Degradation rate of LacI
% d2 Degradation rate of GFP
% n  Hill Coefficient for LacI-promoter binding

y1 = y(1); %[IPTG]
y2 = y(2); %[LacI]
y3 = y(3); %[IPTG-LacI]
y4 = y(4); %[GFP]

%Reversible reaction for formation of IPTG: IPTG-LacI <> IPTG + LacI where k1 = forward rxn constant and k2 = backward rxn constant
%Network ODEs
dy1dt = -k1.*y1.*y2+k2.*y3; %ODE for [IPTG]
dy2dt = k3 - d1.*y2 -k1.*y1.*y2 + y2.*y3; %ODE for [LacI]
dy3dt = k1.*y1.*y2-k2.*y3; %ODE for [IPTG-LacI]
dy4dt = (k4.*km.^n)/(km.^n+y1.^n)-d2.*y4; %ODE for [GFP]

dCdt=[dy1dt; dy2dt; dy3dt; dy4dt];




