%
% geneosc.m
%
% ode system corresponding to the synthetic genetic oscillator made up of
% three pools of mRNA and their associated proteins (lacI,tetR,cL)
%

function F = geneosc(t,y,p)

F = zeros(6,1); % will be right hand side of differential equations

% pull the parameters out of the vector p
a = p(1);       % additional level of mRNA
a0 = p(2);      % baseline level of mRNA
n = p(3);       % number of proteins required to bind and repress
b = p(4);       % decay rate of protein

% assign S1,I1,R1,S2,I2,R2 to an entry of the state vector y
m1 = y(1);      % lac mRNA
m2 = y(2);      % tet mRNA
m3 = y(3);      % cL mRNA
p1 = y(4);      % lac protein
p2 = y(5);      % tet protein
p3 = y(6);      % cL protein

% this defines the four equation system of differential equations.
F(1) = -m1+a/(1+p3^n)+a0;
F(2) = -m2+a/(1+p1^n)+a0;
F(3) = -m3+a/(1+p2^n)+a0;
F(4) = -b*(p1-m1);
F(5) = -b*(p2-m2);
F(6) = -b*(p3-m3);