✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信。
🍎个人主页:Matlab科研工作室
🍊个人信条:格物致知。
更多Matlab仿真内容点击👇
⛄ 内容介绍
Gillespie 算法是仿真均匀化学动力系统的一种标准算法,其一般步骤可以概述如下
⛄ 部分代码
function ssa_example()
% Simulate a two-state model of gene expression
import Gillespie.*
%% Reaction network:
% 1. transcription: 0 --kR--> mRNA
% 2. translation: mRNA --kP--> mRNA + protein
% 3. mRNA decay: mRNA --gR--> 0
% 4. protein decay: protein --gP--> 0
%% Rate constants
p.kR = 0.1;%0.01;
p.kP = 0.1;%1;
p.gR = 0.1;
p.gP = 0.002;
%% Initial state
tspan = [0, 10000]; %seconds
x0 = [0, 0]; %mRNA, protein
%% Specify reaction network
pfun = @propensities_2state;
stoich_matrix = [ 1 0 %transcription
0 1 %translation
-1 0 %mRNA decay
0 -1 ]; %protein decay
%% Run simulation
[t,x] = directMethod(stoich_matrix, pfun, tspan, x0, p);
%[t,x] = firstReactionMethod(stoich_matrix, pfun, tspan, x0, p);
%% Plot time course
figure();
stairs(t,x); set(gca,'XLim',tspan);
xlabel('time (s)');
ylabel('molecules');
legend({'mRNA','protein'});
end
function a = propensities_2state(x, p)
% Return reaction propensities given current state x
mRNA = x(1);
protein = x(2);
a = [p.kR; %transcription
p.kP*mRNA; %translation
p.gR*mRNA; %mRNA decay
p.gP*protein]; %protein decay
end
⛄ 运行结果
⛄ 参考文献
[1] Argoti A , Fan L T , Cruz J , et al. Introducing stochastic simulation of chemical reactions using the gillespie algorithm and MATLAB: Revisited and augmented[J]. Chemical Engineering Education, 2008, 42(1):35-46.
[2]张雄雄, 周永华, 艾矫燕. 基于Gillespie算法及膜系统的藻类生长建模[J]. 计算机仿真, 2019(2):4.
⛄ Matlab代码关注
❤️部分理论引用网络文献,若有侵权联系博主删除