目录
💥1 概述
📚2 运行结果
🎉3 参考文献
👨💻4 Matlab代码
💥1 概述
本次疫情传播呈现出典型的复杂网络特征,可以用复杂网络疾病传播模型进行有效分析。复杂网络经典的疾病传播模型包括SI模型、SIR模型、SIS模型、SEIR模型等。
本文模拟人(点),考虑他们在空间(盒子)中移动。人们以随机的速度行走(v_x,v_y)。当这些人撞到盒子的墙壁时,他们会再次从盒子上反弹回来。在模拟开始时,只有少数人生病(用红色圆点表示)。一旦这些病人(红点)进入健康人(绿点)的附近,他们也会被感染(变成红色)。一段时间后,病人(红点)恢复(变成蓝色),不能再感染或被感染。
结果:
红感染绿健康蓝恢复
📚2 运行结果
主函数部分代码:
%% Student names % Student: Sheik Farooq (419396) %% Command to clean the screen clc; clear; close All; %% Task 1 % Initialization a = 0.01; % minimum x and y values b = 1.99; % maximum x value (Actually 2, but better representation in graph, 1.99 was used) c = 0.99; % maximum y value (Actually 1, but better representation in graph, 0.99 was used) n = 100; % number of individuals dt = 0.001; vel_min = -1; vel_max = 1; infected_initial = 10; % in percentage n_infec = infected_initial*n/100; % no. of infected people n_hel = (100-infected_initial)*n/100; % no. of healthy people n_recov = n-n_infec-n_hel; % no. of recovered people Time = 0:dt:1; % Time vector % initial X and Y positions of the points pos_x_infec = (b-a).*rand(n_infec,1) + a; % Healthy pos_x_infec = [pos_x_infec, dt*ones(size(pos_x_infec))]; pos_y_infec = (c-a).*rand(n_infec,1) + a; pos_x_hel = (b-a).*rand(n_hel,1) + a; % Infected pos_y_hel = (c-a).*rand(n_hel,1) + a; pos_x_rec = []; pos_y_rec = []; vel_x_rec = []; vel_y_rec = []; % initial point positions of healthy and infected points shown in graph figure(1); hold on; plot(pos_x_hel,pos_y_hel, 'o','MarkerFaceColor', 'g','MarkerEdgeColor', 'g') plot(pos_x_infec(:,1),pos_y_infec, 'o','MarkerFaceColor', 'r','MarkerEdgeColor', 'r') % Velocities vel_x_hel = (vel_max-vel_min).*rand(n_hel,1) + vel_min; % Velocities of Healthy vel_y_hel = (vel_max-vel_min).*rand(n_hel,1) + vel_min; vel_x_infec = (vel_max-vel_min).*rand(n_infec,1) + vel_min; % Velocities of infected vel_y_infec = (vel_max-vel_min).*rand(n_infec,1) + vel_min; v=VideoWriter('Pandamic_1.avi'); % saves dynamic graph as a video file open(v); for k=1:length(Time) % Main "for" loop (1 loop (dt)== 0.001 sec % new positions of the persons based on velocity and old position pos_x_new_hel = pos_x_hel + vel_x_hel.*dt; % Healthy pos_y_new_hel = pos_y_hel + vel_y_hel.*dt; pos_x_hel = pos_x_new_hel; pos_y_hel = pos_y_new_hel; pos_x_new_infec = pos_x_infec(:,1) + vel_x_infec.*dt; % Unhealthy pos_y_new_infec = pos_y_infec + vel_y_infec.*dt; pos_x_infec = [pos_x_new_infec pos_x_infec(:,2)+dt]; pos_y_infec = pos_y_new_infec; pos_x_new_rec = pos_x_rec + vel_x_rec.*dt; % Healthy pos_y_new_rec = pos_y_rec + vel_y_rec.*dt; pos_x_rec = pos_x_new_rec; pos_y_rec = pos_y_new_rec; % Recovery of the infected points for j=1:length(pos_x_infec(:,1)) if pos_x_infec(j,2)>=0.35 pos_x_rec = [pos_x_rec; pos_x_infec(j,1)]; pos_y_rec = [pos_y_rec; pos_y_infec(j,1)]; vel_x_rec = [vel_x_rec; vel_x_infec(j,1)]; vel_y_rec = [vel_y_rec; vel_y_infec(j,1)]; pos_x_infec(j,:) = []; % pos_x_infec(j,2) = []; pos_y_infec(j) = []; vel_x_infec(j) = []; vel_y_infec(j) = []; pos_x_infec = [pos_x_infec;[0,0]]; pos_y_infec = [pos_y_infec;0]; vel_x_infec = [vel_x_infec;0]; vel_y_infec = [vel_y_infec;0]; j=j-1; end end
🎉3 参考文献
[1]范如国,王奕博,罗明,张应青,朱超平.基于SEIR的新冠肺炎传播模型及拐点预测分析[J].电子科技大学学报,2020,49(03):369-374.
部分理论引用网络文献,若有侵权联系博主删除。