用matlab对2003年香港SARS数据建模预估新冠病毒在H市的疫情走势

疫情隔离阶段果然是可以心无旁骛安心学习的时光。我在《用matlab对曲线拟合做最小二乘法单目标优化》https://blog.csdn.net/weixin_41855010/article/details/104225901 中查阅了2003年的SARS数据,根据当年香港的病例数据建立并且优化一波指数模型,爬了Z市卫计委的公开数据,用非典参数估计了2月H是的新增和累积,结论是按照现在趋势,2月底H市的累积确诊预计在250见顶。所以还是好好呆在家里吧,疫情应该很快就会过去的。

下面是代码:

clear all;clf;clc;
T=3; %平移量
T0=0.5;%半衰期
Peak=20;%峰值
t=1:5;
y1=1./(1+exp(-(t-T)./T0))*Peak;

% plot(t,y1)
t=1:10
ry2=[19	18	16	13	12	8	14	9	10	5];
plot(t,ry2);
hold on;

for t=1:30
    y2(t)=max(0,ceil(19*exp(-t/10.5)+4*(rand-0.5)));
end
figure(1)
t=1:30
plot(t,y2)
title('H市新冠肺炎新增确诊断数量预测图')
legend('真实值','预测值')

total = [6	12	26	28	32	51	69	85	98	110	118	132	141	151	156]
added = [0  6	14	2	4	19	18	16	13	12	8	14	9	10	5]

for i = 11:30
    added(5+i) = y2(i)
    total(5+i) = total(4+i) + y2(i)
end

Time = length(added);
t=1:Time;

date = datetime(2020,1,23) + caldays(1:Time);
grid on
% figure(1)
% plot(t,added)
figure(2)
plot(date,total)
hold on
xx1 = [5,12,19,26,33]; % x = [6.321,11.15,21.15]
tt1 = date(xx1);
yy1 = total( xx1 ); % 与x对应的y值
tDay = [737819,737826,737833,737840,737847]
DATE = ['Jan.29th:','Feb.5th','Feb.12th','Feb.19th','Feb.26th']
% 画点 标注
for i = 1:length(xx1)
plot(tt1(i),yy1(i),'rs','MarkerEdgeColor','k','MarkerFaceColor','g','MarkerSize',6)
text(tDay(i),yy1(i),[num2str(yy1(i))],'EdgeColor','red','BackgroundColor',[.7 .9 .7],'VerticalAlignment','bottom');
end

title('H市新冠肺炎累计确诊断数量预测图')
xlabel('日期')
ylabel('累计确证人数预测量')
grid on

得到的结果如下:
在这里插入图片描述
在这里插入图片描述
这个预测准不准,2月底来看看验证一下。