% Equation funciton of coupled Repressilator
% 6 variables, 4 Parameters
% modified by Bruce,  2011/06/08

function dy= rep(t,y)
%dy = zeros(6,1);
tau = [2 2 2 2.5 2.5 2.5]' ; %Time constant in Sec of RC for each opamp
beta = 0.07; % coupling constant
g = -10*[1 1 1 1 1 1]' ; % gain of opamp inverters
% thresold voltage = 0
% saturating opamp with gain g
% Vout = -1<=g*Vin<=10
va = g .* [y(3)+beta*y(6) y(1) y(2) y(6)+beta*y(3) y(4) y(5)]' ;
va(va>10) = 10;
va(va<-1) = -1;

%RC only
dy = (va - y)./tau ;

end

% For
% tau = [2 2 2 3 3 3]' ; %Time constant in Sec of RC for each opamp
% g = -12*[1 1 1 1 1 1]' ; % gain of opamp inverters
% beta = .1 yields 1:1 phase lock with repeat period 1
% beta = .105 yields 1:1 phase lock with repeat period 3
% beta = .12 yields 1:1 phase lock with repeat period 4
% beta = .15 yields chaotic pattern
% beta = .3 yields 1:1 phase lock with repeat period 2
% beta = .4 yields 1:1 phase lock with repeat period 1

%For
% tau = [2 2 2 3 3 3]' ; %Time constant in Sec of RC for each opamp
% g = -4*[1 1 1 1 1 1]' ; % gain of opamp inverters
% beta = .03 yields 3:2 phase lock with repeat period 3 (rep1)
% beta = .15; yields 4:3 phase lock with repeat period 4 (rep1)
% beta = .2; yields 1:1 phase lock with repeat period 1 (rep1)
% beta = .12; yields complex pattern, possible repeat period 7

%For
% tau = [2 2 2 2.5 2.5 2.5]' ; %Time constant in Sec of RC for each opamp
% g = -10*[1 1 1 1 1 1]' ; % gain of opamp inverters
% beta = 0.05; yields long repeat period (~21?)
% beta = 0.1; yields yields 1:1 phase lock with repeat period 1


