%Let's simulate a stochastic process of birth and death of mRNAs
%Model parameters
r=3; %1/min
gamma=1/3; %1/min/mRNA
%Simulation parameters
dt=0.005; %min
TotalTime=40; %min, we choose to be larger than 1/gamma
Time=0:dt:TotalTime;%min
%Initial condition
m(1)=0;
%Start the simulation
for i=2:length(Time) %Move through all time points
Coin=rand; %Flip our random coin, which we will turn into a
%biased, three-sided coin
%Decide which trajectory to take given the coin flip
if Coin