数学建模基于matlab SIR模型新冠病毒COVID-19估计含Matlab源码 2042期

Posted 海神之光

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了数学建模基于matlab SIR模型新冠病毒COVID-19估计含Matlab源码 2042期相关的知识,希望对你有一定的参考价值。

一、SEIR模型简介

1 SEIR模型简介

如果所研究的传染病有一定的潜伏期,与病人接触过的健康人并不马上患病,而是成为病原体的携带者,归入 E 类。此时有:

仍有守恒关系 S(t) + E(t) + I(t) + R(t) = 常数,病死者可归入 R 类。潜伏期康复率 γ1 和患者康复率 γ2 一般不同。潜伏期发展为患者的速率为 α。与 SIR 模型相比,SEIR 模型进一步考虑了与患者接触过的人中仅一部分具有传染性的因素,使疾病的传播周期更长。疾病最终的未影响人数 S∞ 和影响人数 R∞ 可通过数值模拟得到。

2 SEIR模型中的S\\E\\I\\R分别表示什么


SEIR模型是传染病模型的一种,一般将传染病流行范围内的人群分为以下几类:
(1)S 类,易感者 (Susceptible),指未得病者,但缺乏免疫能力,与感染者接触后容易受到感染;
(2)E 类,暴露者 (Exposed),指接触过感染者,但暂无能力传染给其他人的人,对潜伏期长的传染病适用;
(3)I 类,感病者 (Infectious),指染上传染病的人,可以传播给 S 类成员,将其变为 E 类或 I 类成员;
(4)R 类,康复者 (Recovered),指被隔离或因病愈而具有免疫力的人。如免疫期有限,R 类成员可以重新变为 S 类。

二、部分源代码

close all
addpath(‘CV19’)
addpath(‘data’)
%w1 - weigth for values, w2 - weight for derivatives, prn - print results
res = fitVirusCV19(@getDataAustria,‘prn’,‘on’,‘jpg’,‘on’,‘jpres’,‘-r300’);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% STEP 1: download the data and convert the file format %%%
%%% added by Igor Podlubny, (igor.podlubny@tuke.sk) %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% get the current date in YYYYMMDD format
currentDateYYYYMMDD = strrep(datestr(date, 26), ‘/’, ‘’);
% set the filenames
fileCSV = [‘totalcases’, currentDateYYYYMMDD, ‘.csv’];
fileXLSX = [‘totalcases’, currentDateYYYYMMDD, ‘.xlsx’];

% import data from https://ourworldindata.org/coronavirus-source-data
% download the ‘totalcase.csv’ file
tcFileCSV = websave(fileCSV,‘https://covid.ourworldindata.org/data/ecdc/total_cases.csv’);

% read the CSV file, and then save it to XLSX format
TMPFILE = readtable(fileCSV);
writetable(TMPFILE,fileXLSX);

% we will write the results of parsing into the appropriate folder;
% in order to use the original Milan Batista’s code, we put:
path = pwd;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% STEP 2: Split the data for individual countries %%%
%%% Milan Batista’s original code for parsing %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Amin = 5; % data les than Amin will be deleted from file begining

% get table
T = readtable(fileXLSX);

% get data
A = T:,2:end;
[nrow,ncol] = size(A);

% table column names
name = string(T.Properties.VariableNames);
name = name(2:end)';

% start date
date0 = datenum(T1,1); %datenum(txt2,1,‘dd.mm.yyyy’); %datenum(‘2019/12/31’);

% end date
%date1 = date0 + nrow - 1;

%functions names
ffname = strings(ncol,1);
nn = 0;
for n = 1:ncol
nname = namen;
if strcmp(“”,nname)
continue
end
nn = nn + 1;
nname = strrep(nname,’ ‘,’‘);
nname = strrep(nname,’-‘,’
‘);
nname = strrep(nname,’‘’‘,’‘);
nname = strrep(nname,’(‘,’
‘);
nname = strrep(nname,’)‘,’‘);
fname = sprintf(‘getData%s.m’,nname);
fid = fopen(fullfile(path,fname),‘w’);
if fid < 0
fprintf(’***Fail to open %s\\n’,fname);
continue
end
fprintf(‘%d/%d country %s …\\n’,ncol,n,nname);
ffname(nn) = nname;
fprintf(fid,‘function [country,C,date0] = getData%s()\\n’,nname);
fprintf(fid,‘%%GETDATA%s Coronavirus data for %s\\n’,upper(nname),nname);
fprintf(fid,‘%% as reported by One World in Data\\n’);
fprintf(fid,‘%% https://ourworldindata.org/coronavirus-source-data\\n’);
fprintf(fid,‘country = ‘’%s’‘;\\n’,strrep(name(n),’ ‘,’
‘));
fprintf(fid,‘C = [\\n’);
found = false;
nday = 0;
for m = 1:nrow
if ~found && (isnan(A(m,n)) || A(m,n) == 0 || A(m,n) < Amin)
nday = nday + 1;
continue
else
found = true;
end
fprintf(fid,’ %9d %% %s\\n’,A(m,n),datestr(date0 + m - 1));
end
fprintf(fid,‘%%<-------------- add new data here\\n’);
fprintf(fid,‘]’‘;\\n’);
% start date
fprintf(fid,‘date0=datenum(’‘%s’‘);\\n’,datestr(date0 + nday));
fprintf(fid,‘end\\n’);
fclose(fid);

%generete driver rutine
fname = 'runAll.m';
fid = fopen(fullfile(path,fname),'w'); 
if fid < 0
    fprintf('***Fail to open %s\\n',fname);
    continue
end
fprintf(fid,'prn = ''off'';\\n');
fprintf(fid,'plt = ''on'';\\n');
for n = 1:nn
    fprintf(fid,'try\\n');
    fprintf(fid,'  fitVirusCV19(@getData%s,''prn'',prn,''jpg'',plt)\\n',...
        ffname(n));
    fprintf(fid,'end\\n');
end
fclose(fid);

cd(oldFolder)

end

三、运行结果

四、matlab版本及参考文献

1 matlab版本
2014a

2 参考文献
[1]李昕.MATLAB数学建模[M].清华大学出版社.2017
[2]王健,赵国生.MATLAB数学建模与仿真[M].清华大学出版社.2016
[3]余胜威.MATLAB数学建模经典案例实战[M].清华大学出版社.2015

3 备注
简介此部分摘自互联网,仅供参考,若侵权,联系删除

以上是关于数学建模基于matlab SIR模型新冠病毒COVID-19估计含Matlab源码 2042期的主要内容,如果未能解决你的问题,请参考以下文章

matlab常微分方程在传染病建模中的应用

Python小白的数学建模课-B4. 新冠疫情 SIR模型

SpeeDx的新冠病毒诊断检测系统获得批准

Python小白的数学建模课-B2. 新冠疫情 SI模型

Python小白的数学建模课-B3. 新冠疫情 SIS模型

Python小白的数学建模课-B5. 新冠疫情 SEIR模型