%Script for numerical integration of an autoactivated switch
%Clear all variables. You shouldn't worry too much about this.
clear all
%Parameters of the model
dr=30; %Production at maximum mRNA number in 1/min
r0=0.05*dr; %Basal rate of production in 1/min
gamma=1/30; %Degradation rate in 1/min
Kd=450; %Dissociation constant
dt=0.1; %Time step for our calculation
TotalTime=500; %Total time of integration
%How many steps of integration do we need to take?
NumberTimeSteps=TotalTime/dt;
m(1)=0; %Initial conditions
%We also need ot keep track of time
Time(1)=0;
for i=2:NumberTimeSteps
%At each time point account for production and degradation of mRNA
%molecules
m(i)=m(i-1)-gamma*dt*m(i-1)+r0*dt+dt*dr*(m(i-1)/Kd)^2/(1+(m(i-1)/Kd)^2);
Time(i)=Time(i-1)+dt;
end
%Now plot the results
plot(Time,m)
xlabel('Time (min)')
ylabel('Number of mRNA molecules')