File Exchange

## SIR Math Model of Virus Spread (Coronavirus or other)

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

Updated 12 Apr 2020

Editor's Note: This file was selected as MATLAB Central Pick of the Week

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 (2021). 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 .

Ryan Ning

Thank you so much for sharing. Great tools for not only modeling virus spread but also other applications.

Gaston Guerra

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.