• Gillespie 随机模拟算法附matlab代码


    ✅作者简介:热爱科研的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代码关注

    ❤️部分理论引用网络文献,若有侵权联系博主删除

    ❤️ 关注我领取海量matlab电子书和数学建模资料

  • 相关阅读:
    基于单片机的显示系统
    【笔试刷题训练】day_17
    C++中自定义数据结构作为unordered-set以及set中的元素
    C语言求一维数组循环左移一位
    JCMsuite应用:光子晶体谐振腔光子晶体谐振腔
    工厂方法模式
    【C语言】带头双向循环链表(list)详解(定义、增、删、查、改)
    Java线程安全与对象头结构信息
    查看linux开发板的CPU频率
    deque容器(20221115)
  • 原文地址:https://blog.csdn.net/matlab_dingdang/article/details/127933125