COVID-19 SIR Modelling 

 June 12, 2020

By  MayuriParkhe

Move quickly from one page to another within COVID-19 Series from MATLAB Helper:

Modelling diseases by using mathematical models could be considered a powerful approach since they bring us some information about the spread of a particular virus as well as estimating the peak of the pandemics by taking the necessary measures. Nowadays, most of the epidemic diseases are usually dealt with by SI, SIS, and SIR models.

Model parameters

For this model, only three parameters must be defined. Since N is related to the number of individuals in the population, only ????and ???? will be explained.

•????: this parameter describes the effective contact rate of the disease

• ????: This parameter is related to the recovery rate; more precisely, this shows how long (days) could the virus be transmitted.

SIR model Equation

Setting initial conditions for the model

As you see, three initial conditions for S(t), I(t), R(t) should be defined. For that:

  • Infected I(t) individuals are usually set as 1, i.e. to say, the model begins on its first day with one individual infected.
  • By this way, the recovered individual R(t) starts as zero.
  • Finally, susceptible people S(t) is given to be the resulting value between N – I(t) – R(t) since all, i.e.  S(t)+I(t)+R(t) should always be equal to 100% of the population which is N. 

So, we have already seen what the SIR model is and how useful it is. We have explained the mathematics of SIR Model in details in our COVID-19 Video series, and you must watch the video to understand it better. Now we are going to show you how to use MATLAB to model real data! So, be comfortable, start your MATLAB on your machine and let's do the coding!


We have used data untill 31st May 2020 for all these analysis. We have seen some approaches to modelling diseases such as COVID-19 through MATLAB. We have found essential characteristics within this process. We have done Data Analysis and Data Extraction and included a reliable source for the COVID-19 data. We have used preprocessing to extract a subset of the collected data and organise the data accurately. We have done Data Modelling with model construction, i.e. finding the best model that fits the COVID-19 pandemic. We have done the calculation of model parameters using real collected data and finally done the Data Visualisation. All these steps were essential, and luckily, MATLAB has so many functions and tool to use in the given scenario.

Now summing our analysis and coming to a definite conclusion, India's COVID-19 case tally climbed from 100 to one lakh in just 64 days as per the data sourced from the Union Ministry of Health & Family Welfare (MoHFW). On comparing this with global data, sourced from Worldometers, it has been found out that India's COVID-19 growth rate is more than double the number of days as compared to Colombia.

Important Note

Our COVID-19 codes and analysis have been made for educational and research purpose. We have shown different approaches of Pandemic Modelling for each state and the accuracy of result is not guaranteed for real-life situation. We wish for early end of this pandemic. Now it's in our hands; we need to take our responsibilities & take proper precautions.

Now let's have a quick view of the precautions.

Stay Home for non-essential activities!

COVID-19 Work from home

Avoid going to crowded areas. Work From Home and Be A Super Hero

Always wear a mask

COVID-19 Always wear a mask

Maintain distance while conversing with someone. Avoid touching your face frequently

Wash your hands regularly!

COVID-19 Wash your hands frequently

Wash your hand for 20 seconds.  KEEP A SANTISER ALWAYS with you, wherever you go.

Cover your Mouth!

COVID-19 Cover your mouth

While sneezing or coughing, always cover your mouth with a handkerchief or with your arm.

Home Quarantine

COVID-19 Home quarantine

If you have been facing the symptoms of Cold and Cough or the one's shown with COVID-19, then self-isolate yourself with home quarantine for 14 days.  So stay home stay safe; this is the best way you can contribute to the betterment of the nation.

About the author 


Mayuri Parkhe is a MATLAB Developer at MATLAB Helper.
A B.E. graduate with an EXTC background from the University of Mumbai.
She believes if one wants to set off and go develop something brand new, he doesn't need millions of dollars of capitalization. All the person needs is a comfortable space around you and enough time to work on, and the dedication to go through with it.

  • Nikita Mahoviya says:

    This explanation gave me an insight of what SIR equations are!!

  • {"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

    MATLAB Helper ®

    Follow: YouTube Channel, LinkedIn Company, Facebook Page, Instagram Page

    Join Community of MATLAB Enthusiasts: Facebook Group, Telegram, LinkedIn Group

    Use Website Chat or WhatsApp at +91-8104622179