From 2006.igem.org
function varargout = ode_counter(t,y,flag,para)
switch flag
case ' '
% parameter values
n = para(1); % Kooperativität der Zinkfinger
nSa = para(2); % Kooperativität von S (als Aktivator)
nSr = para(3); % Kooperativität von S (als Repressor)
K = para(4); % Affinität (höheres K = höhere Affinität)
KSa = para(5);
KSr = para(6);
k = para(7);
kd = para(8); % Degradationsrate der Zinkfinger
period = para(9);
% input signal
S = input_signal(t,period);
% calculate RHS states
% product of act and rep, respectively, since the "roadblocks" (mechanical obstacle) are
% in succession (probabilities multiplied)
% Joerg roughly agrees.
dy1 = [k * act(S,KSa,nSa) * rep(y(2),K,n) * rep(y(3),K,n) - kd * y(1)];
dy2 = [k * rep(S,KSr,nSr) * rep(y(3),K,n) * rep(y(4),K,n) - kd * y(2)];
dy3 = [k * act(S,KSa,nSa) * rep(y(4),K,n) * rep(y(1),K,n) - kd * y(3)];
dy4 = [k * rep(S,KSr,nSr) * rep(y(1),K,n) * rep(y(2),K,n) - kd * y(4)];
% pack to array
dy = [dy1;dy2;dy3;dy4];
% assign output
varargout{1} = dy;
case 'init'
y0 = y;
otherwise
error(['Unknown flag flag .']);
end
return