Sign up, and CougarBoard will remember which categories you want to view. Sign up
Mar 28, 2020
1:34:51pm
Zoobieman Truly Addicted User
Matlab Model of COVID-19 growth
Seeing as I am still stuck in Quarantine:
I created a Matlab model of Covid-19 growth that engineers can use to help determine the growth pattern that we can expect.

Note: I used the SEIR model for differential equations, in addition I used Eulers method as I can effectively make day to day changes in how the interventions and treatment plans can change the actual treatment rate vs the model.



%% Matlab Code
%Differential equation function
function [dQ, dE, dI, dS, dC, dR, died] = COVID_Euler(Q, E, I, S, C, Pop, Ro, Natural_Immune)

% Q = Susceptible
% E = Incubating disease
% I = Infectious
% S = Symptomatic
% C = Critical
% R = Recovery

%Parameters all in days
Incubation_time = 1;
Infectious_time = 3;
Population_Increase = (1001734/365.0);
Symptom_Time = 5;
Crit_Time = 10;
prob_Crit = 0.04; %Probability someone with symptoms becomes cr
prob_Death = 0.25;


r = Ro * (Q/(Pop * (1-Natural_Immune)))
New_Incubate = I*r / Infectious_time;
New_Infectious = E/Incubation_time;
New_Symptomatic = I/Infectious_time;
S_out = S/Symptom_Time;
Cout = C/Crit_Time;
New_Crit = S_out * prob_Crit;
died = Cout * prob_Death;
New_Recovery = (S_out + Cout) - (New_Crit + died);


dQ = Population_Increase - New_Incubate;
dE = New_Incubate - New_Infectious;
dI = New_Infectious - New_Symptomatic;
dS = New_Symptomatic - S_out;
dC = New_Crit - Cout;
dR = New_Recovery;



%============================================================
% Main file using assumption of no policy or government intervention
%============================================================
clear all; clc;

%% Parameters
R_0 = 2.5; % A single infected person will infect about Ro others in a novel population
N = 327.23e6; % Population of USA (2020)
Natural_Immunity = 0.35; %Natural immuninity in the general population, This is to include rural areas with reduced spread and infection.
total_Time = 200;
Pre_Recovered = 10000000; %Assume 10 million people not tested already recovered


Q = zeros(1,total_Time); % Q = Susceptible
E = zeros(1,total_Time); % E = Incubating disease
I = zeros(1,total_Time); % I = Infectious
S = zeros(1,total_Time); % S = Symptomatic
C = zeros(1,total_Time); % C = Critical
R = zeros(1,total_Time); % R = Recovery
t = 1:total_Time;
Dead = zeros(1,total_Time);

%Stats on March 27 2020

Q(1) = N*(1 - Natural_Immunity);
E(1) = 500000;
I(1) = 500000;
S(1) = 20000;
C(1) = 2463;
R(1) = 2522 + Pre_Recovered;
Dead(1) = 1696;


%% Differential equations

for i = 1:(total_Time-1)
[dQ,dE,dI,dS,dC,dR,Dying] = COVID_Euler(Q(i), E(i), I(i), S(i), C(i), N, R_0, Natural_Immunity);

k = (i+1);
Q(k) = Q(i) + dQ;
E(k) = E(i) + dE;
I(k) = I(i) + dI;
S(k) = S(i) + dS;
C(k) = C(i) + dC;
R(k) = R(i) + dR;
Dead(k) = Dying;

end

Height = (1.2 * max(I));
HeightCrit = (1.2* max(C));
Hospitalized = 0.15*S;
Total_Dead = sum(Dead)



%% plot
figure(1)
plot(t,E, 'c', t,I, 'g', t,Hospitalized,'y', t,C,'r')
legend('Pre-Infectious','Infectious','Hospitalized', 'Critical', 'Location', 'Best')
axis([0 total_Time 0 Height]);
xlabel('Days after March 26, 2020')
ylabel('Population')
title('USA Predicted Spread of COVID-19');
grid on;
grid minor;
set(gca, 'FontSize', 26)


figure(2)
plot(t,C,'r', t,Dead,'k')
legend('Critical', 'Death', 'Location', 'Best')
axis([0 total_Time 0 HeightCrit/10]);
xlabel('Days after March 26, 2020')
ylabel('Population')
title('USA Predicted Spread of COVID-19')
grid on;
grid minor;
set(gca, 'FontSize', 26)
Zoobieman
Bio page
Zoobieman
Joined
Apr 23, 2012
Last login
Apr 26, 2024
Total posts
10,502 (29 FO)
Messages
Author
Time

Posting on CougarBoard

In order to post, you will need to either sign up or log in.