File Exchange

image thumbnail

SIR Math Model of Virus Spread (Coronavirus or other)

version 1.0.20 (25.6 KB) by Tom Beekhuysen
Introductory model of infectious disease spread. Social distancing and social isolation affects beta (transmission rate).

468 Downloads

Updated 12 Apr 2020

View License

You can change infection rate (transmission rate) and see how spread is affected (flatten the curve). Infection rate = beta = number of social contacts x probability of contracting virus each contact. When we socially isolate we reduce beta and therefore spread.

An individual is infectious for approximately 7 days. During this time they pass covid19 to approximately 2.5 people. These 2 basic parameters determine the model dynamics.

Simulink model is of the following system of three odes:

dS/dt = -β(I/N)S
dI/dt = β(I/N)S – γI
dR/dt = γI

S = Number Susceptible Individuals
I = Number Infectious Individuals
R = Number Recovered Individuals
N= Total Population
β = Ep = Number Social contacts x probability of transmitting disease each contact = Infection rate
γ = Recovery Rate

Key scenarios of dynamics:
If, during 7 days of being infectious, a person passes to 1 person then the disease will not grow, i.e., number of infectious individuals stays the same.
If, during 7 days of being infectious, a person passes to 2 or more people the disease grows, i.e., number of infectious individuals grows.
If, during 7 days of being infectious, a person does not pass to another person (or, say 10 people are sick at exact same time and pass to 9 people over 7 days) the disease will reduce, i.e., number of sick individuals goes to zero.
As individuals recover, the number of susceptible people decline, and therefore spread slows and eventually reduces to zero.

Cite As

Tom Beekhuysen (2020). SIR Math Model of Virus Spread (Coronavirus or other) (https://www.mathworks.com/matlabcentral/fileexchange/74697-sir-math-model-of-virus-spread-coronavirus-or-other), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (4)

Very good submission. Shall set it up in VBA and try the model. See what I can learn out of it

Cruz Ek

please save and share it by "Previous Version"

Wu Yue

Could you kindly share the code in Matlab?

Clement

Dear Tom Beekhuysen,
I have MatlabR2018b but couldn't open the file. I got a message saying that file has to be opened using Matlab2019b.
Can you help in this regard.
Thank you for your assistance.

Updates

1.0.20

Updated file.

1.0.19

Updated file.

1.0.18

Updated preview.

1.0.17

Updated preview.

1.0.16

Exported to R2018a.

1.0.15

Exported to version R2018a.

1.0.14

Corrected parameter.

1.0.13

Preview image.

1.0.12

Updated beta and gamma based on more recent data.

1.0.11

corrected typo.

1.0.10

Updated description.

1.0.9

Corrected typo.

1.0.8

Added notes in description and model about specific parameters to covid19. Typical individual is infectious 2-4 weeks. Rate of recovery is 25 days (3 weeks plus 4 days safety factor). Reported reproduction number is 2-3 (2.5).

1.0.7

Added note in slx model about when beta<gamma (infection rate is less than recovery rate) spread stops.

1.0.6

updated preview image

1.0.5

Exported to earlier version; 2018a.

1.0.4

Update image.

1.0.3

Updated text

1.0.2

Added system of odes to description and updated slx file

1.0.1

Corrected typo

MATLAB Release Compatibility
Created with R2018a
Compatible with any release
Platform Compatibility
Windows macOS Linux