File Exchange

image thumbnail


version 1.0.1 (2.99 KB) by Lateef Adewale Kareem
% This file simulates SIR model for the spread of infectious diseases


Updated 29 Mar 2020

View Version History

View License

% Np = the population of the community. (Default = 100, so you easily
% read the percentage of the community infectious/infected)
% Ni = the number of index case (initial infecious individual, Default = 1).
% Ds = is the minimum safe distance below which the probability of being
% infected is Prinf (Measure of how contagious the disease is:
% Lower means more contagious. Default = 0.05).
% Prinf = probability that you will be infected if you are closer than Ds
% to an infectious iindividial (Measure of how precautious people
% are: washing hands, not touching mucus membrane. Default = 0.2).
% Tr = Time it takes for an individual to be removed from the population
% (Death, Quarantined, Recovered and become immuned. Default = 1).
% F = Relative repulsive force strength (measure of social distancing Default = 1)
% videoname = Simulation video file name

Cite As

Lateef Adewale Kareem (2021). SIRModelSimulation (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (4)

Fu Qi Chua

Hi, Can I know more about the coding architecture?
Do you have any references for it?
Like what random process is applied?

Lateef Adewale Kareem

Hi, trupti borhade

I am so sorry, I have not been looking at this post and I forgot to set matlab to notify me when a comment is posted. Just changing the the value of F should handle that. No need to change other parameters.

You can watch this video for a guide.

trupti borhade

Hi, I have downloaded the file and ran a simulation. Just wanted to ask if I have to show different scenarios of social distancing, will changing F flatten the curve? or do I need to change other parameters as well? I'm new to Matlab hence not well versed with the codes

Engin Can Sürmeli

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

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!