How do I specify which reaction is next in the First Reaction Method?
1 次查看(过去 30 天)
显示 更早的评论
I'm evaluating a set of reactions (Brusselator Reactions) with the Direct Method (DM) and First Reaction Method (FRM) of the Gillespie Algorithm. While calculating with the DM was relatively straight forward, I'm having trouble understanding how to update my quantities of reagents given the smallest time step.
Given this set of update rules from the DM for this system:
while N<tstop
N=N+1;
s1=rand;
tnext=(1/a)*log(1/(1-s1));
T=T+tnext;
s2=rand*P4;
decision=zeros(4,1);
decision(1)= s2<=P1;
decision(2)=(s2>P1)&&(s2<=P2);
decision(3)=(s2>P2)&&(s2<=P3);
decision(4)=(s2>P3)&&(s2<=P4);
X1=X1-decision(1)-decision(2);
X2=X2-decision(2);
Y1=Y1+3*decision(3)-decision(2)-2*decision(3)-decision(4);
Y2=Y2+decision(2)-decision(3);
Z1=Z1+decision(2);
Z2=Z2+decision(4);
end
And this selection for the smallest time step in the FRM:
a=[a1 a2 a3 a4];
...
while N<simstps
N=N+1;
s=rand(4,1);
tnext=(1./a).*log(1./(1-s));
[a,b]=find(min(tnext));
T=T+tnext(a,b);
end
How do I update the quantities of X, Y, and Z using the coordinates of the smallest time step in the FRM? Any and all advice is appreciated.
0 个评论
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!