数学建模学习笔记(十七)传染病模型(SIER)

传染病模型讲解比较清楚的是知乎这位博主,文章链接戳这在家宅着也能抵抗肺炎!玩一玩SEIR传染病模型
本文基于这篇文章进行记录和整理

对于一般传染病来说,都具备潜伏者(E),因此直接记录传统的SIER模型:
在这里插入图片描述
模型公式:
{ d S d t = − r β I S N d E d t = r β I S N − σ E d I d t = σ E − γ I d R d t = γ I \left\{ \begin{array}{l} \frac{ {dS}}{ {dt}} = - \frac{ {r\beta IS}}{N}\\ \\ \frac{ {dE}}{ {dt}} = \frac{ {r\beta IS}}{N} - \sigma E\\ \\ \frac{ {dI}}{ {dt}} = \sigma E - \gamma I\\ \\ \frac{ {dR}}{ {dt}} = \gamma I \end{array} \right. dtdS=NrβISdtdE=NrβISσEdtdI=σEγIdtdR=γI
迭代公式:
{ S n = S n − 1 − r β I n − 1 S n − 1 N E n = E n − 1 + r β I n − 1 S n − 1 N − σ E n − 1 I n = I n − 1 + σ E n − 1 − γ I n − 1 R n = R n − 1 + γ I n − 1 \left\{ \begin{array}{l} {S_n} = {S_{n - 1}} - \frac{ {r\beta {I_{n - 1}}{S_{n - 1}}}}{N}\\ \\ {E_n} = {E_{n - 1}} + \frac{ {r\beta {I_{n - 1}}{S_{n - 1}}}}{N} - \sigma {E_{n - 1}}\\ \\ {I_n} = {I_{n - 1}} + \sigma {E_{n - 1}} - \gamma {I_{n - 1}}\\ \\ {R_n} = {R_{n - 1}} + \gamma {I_{n - 1}} \end{array} \right. Sn=Sn1NrβIn1Sn1En=En1+NrβIn1Sn1σEn1In=In1+σEn1γIn1Rn=Rn1+γIn1

引入潜伏者传染概率,改进SEIR模型,
公式为
{ d S d t = − r β I S N − r 2 β 2 E S N d E d t = r β I S N − σ E + r 2 β 2 E S N d I d t = σ E − γ I d R d t = γ I \left\{ \begin{array}{l} {\frac{ {dS}}{ {dt}} = - \frac{ {r\beta IS}}{N} - \frac{ { {r_2}{\beta _2}ES}}{N}}\\ {}\\ {\frac{ {dE}}{ {dt}} = \frac{ {r\beta IS}}{N} - \sigma E + \frac{ { {r_2}{\beta _2}ES}}{N}}\\ {}\\ {\frac{ {dI}}{ {dt}} = \sigma E - \gamma I}\\ {}\\ {\frac{ {dR}}{ {dt}} = \gamma I} \end{array} \right. dtdS=NrβISNr2β2ESdtdE=NrβISσE+Nr2β2ESdtdI=σEγIdtdR=γI

迭代公式为:
{ S n = S n − 1 − r β I n − 1 S n − 1 N − r 2 β 2 E n − 1 S n − 1 N E n = E n − 1 + r β I n − 1 S n − 1 N − σ E n − 1 + r 2 β 2 E n − 1 S n − 1 N I n = I n − 1 + σ E n − 1 − γ I n − 1 R n = R n − 1 + γ I n − 1 \left\{ \begin{array}{l} {S_n} = {S_{n - 1}} - \frac{ {r\beta {I_{n - 1}}{S_{n - 1}}}}{N} - \frac{ { {r_2}{\beta _2}{E_{n - 1}}{S_{n - 1}}}}{N}\\ \\ {E_n} = {E_{n - 1}} + \frac{ {r\beta {I_{n - 1}}{S_{n - 1}}}}{N} - \sigma {E_{n - 1}} + \frac{ { {r_2}{\beta _2}{E_{n - 1}}{S_{n - 1}}}}{N}\\ \\ {I_n} = {I_{n - 1}} + \sigma {E_{n - 1}} - \gamma {I_{n - 1}}\\ \\ {R_n} = {R_{n - 1}} + \gamma {I_{n - 1}} \end{array} \right. Sn=Sn1NrβIn1Sn1Nr2β2En1Sn1En=En1+NrβIn1Sn1σEn1+Nr2β2En1Sn1In=In1+σEn1γIn1Rn=Rn1+γIn1

matlab代码:
源代码:

clear;clc;

%--------------------------------------------------------------------------
%   参数设置
%--------------------------------------------------------------------------
N = 12700000;                                                                  %人口总数
E = 0;                                                                      %潜伏者
I = 1;                                                                      %传染者
S = N - I;                                                                  %易感者
R = 0;                                                                      %康复者

r = 20;                                                                     %感染者接触易感者的人数
B = 0.03;                                                                   %传染概率
a = 0.1;                                                                    %潜伏者转化为感染者概率
y = 0.1;                                                                    %康复概率

T = 1:140;
for idx = 1:length(T)-1
    S(idx+1) = S(idx) - r*B*S(idx)*I(idx)/N;
    E(idx+1) = E(idx) + r*B*S(idx)*I(idx)/N-a*E(idx);
    I(idx+1) = I(idx) + a*E(idx) - y*I(idx);
    R(idx+1) = R(idx) + y*I(idx);
end

plot(T,S,T,E,T,I,T,R);grid on;
xlabel('天');ylabel('人数')
legend('易感者','潜伏者','传染者','康复者')

稍作改进,反应每日新增病例情况:

%--------------------------------------------------------------------------
%   初始化
%--------------------------------------------------------------------------
clear;clc;

%--------------------------------------------------------------------------
%   参数设置
%--------------------------------------------------------------------------
N = 29000;                                                                  %人口总数
E = 0;                                                                      %潜伏者
I = 1;                                                                      %传染者
S = N - I;                                                                  %易感者
R = 0;                                                                      %康复者
m=1;

r = 25;                                                                     %感染者接触易感者的人数
B = 0.03;                                                                   %传染概率
a = 0.1;                                                                    %潜伏者转化为感染者概率
r2 = 3;                                                                     %潜伏者接触易感者的人数
B2 = 0.03;                                                                  %潜伏者传染正常人的概率
y = 0.1;                                                                    %康复概率

T = 1:182;
for idx = 1:length(T)-1
    S(idx+1) = S(idx) - r*B*S(idx)*I(idx)/N(1) - r2*B2*S(idx)*E(idx)/N;
    E(idx+1) = E(idx) + r*B*S(idx)*I(idx)/N(1)-a*E(idx) + r2*B2*S(idx)*E(idx)/N;
    I(idx+1) = I(idx) + a*E(idx) - y*I(idx);
    R(idx+1) = R(idx) + y*I(idx);
    m(idx+1) = E(idx+1) + I(idx+1);
end


x=1:182;
plot(x,m);grid on;
xlabel('day');ylabel('Demand for drugs')

你可能感兴趣的:(数学建模学习笔记)