SIR Math Model of Virus Spread (Coronavirus or other)
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 (2022). 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 .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.