image thumbnail


versión 5.2.1 (8.04 MB) por milan batista
Estimation of coronavirus COVID-19 epidemic evaluation by the SIR model

5,4K descargas

Actualizada 12 May 2020

Ver licencia

Nota del editor: This file was selected as MATLAB Central Pick of the Week

The function fitVirusCV19 implements the susceptible-infected-removed (SIR) epidemic model for the estimation of epidemy evaluation. It is assumed that the model is a reasonable description of the one-stage epidemic. In particular, the model assumes a constant population, uniform mixing of the people, and equally likely removalof infected. The model is data-driven, so its forecast is as good as data are. The forecasting change with new or changed data. The officially declared outbreak of the epidemic and the outbreak of the epidemic as it reported by the program have nothing to do with each other. The program indicates the start date when the data is sufficient to calculate the initial approximation.

For those who are not familiar with epidemic models, we suggest the following articles:, , and

The parameters of the model are obtained by minimization of the objective function, which is the sum of squares for residuals of values and sum of squares for residuals of values differences. The weights of summands are selected automatically. Optimization Toolbox function fminsearch is used to calculate optimal values of unknown model parameters. If the calculation fails then only data are plotted.

The contribute contains data for coronavirus for Argentina, Austria, Belgium, Brazil, Canada, Croatia, China, Czech Republic, Denmark, Germany, Hungary, France, Iceland, India, Indonesia, Iran, Italy, Japan, Netherlands, Norway, Poland, Portugal, Romania, Russia, Slovakia, Serbia, Slovenia, South Korea, Spain, Switzerland, Turkey, UK, USA and World (up to 28.April.2020)

On the epidemy evaluation graph, regions color separate epidemy phases (these are not standard but arbitrarily chosen for convenience):
red - fast growth phase
yellow - transition to steady-state phase
green - ending phase (plateau stage)

On the total cases graph, margins are +/-3*RMSE; on daily new cases graph, margins are +/dRMSE.

On Daily Cases Growth Factor graph two lines 1% (green) and 5% (red) are shown only for orientation reason.

Results are saved in structure res (see function fiVirusCV19 header). Optionally the results may be printed by


where XXX stands for the country name. When regression fails then only data are plotted. Population size is limited to 12 Mio. You can change the upper limit by name/value pair:


Use this option if the final prediction is too high or exceed the country's population.

To exclude growth rate from the graph on the figure use (def value is 3)


Function analyseCV plots a graph of evaluation of contact number (sigma), Cend (epidemic size), N (initial susceptible population size). To analyze data for country XXX from 10 days of epidemic onward use


DISCLAIMER: Software and data are for education and not for medical or commercial use. The model may fail in some situations. In particular, the model may be inadequate; the model may fail in the initial phase and in when additional epidemic stages or outbreaks (not described by SIR model) are encountered. Use it at your own discretion.
The data are only for demonstrating the operation of fitVirusCV19. FitVirus and presented demo data are only for educational and academic purposes and should not be used for medical purposes and in commerce. They are provided as is and any express or implied warranties, including but not limited to implied warranties of merchantability and fitness for a particular purpose are disclaimed.

Source of data
An actual source of data is for each country reported in the corresponding getData function.

NEW: importTotalCases function read and generate data from <ourworldindata> data file (by Igor Podlubny )

A more detailed description can be found in
Examples can be found in

Citar como

milan batista (2022). fitVirusCOVID19 (, MATLAB Central File Exchange. Recuperado .

Compatibilidad con la versión de MATLAB
Se creó con R2020a
Compatible con cualquier versión
Compatibilidad con las plataformas
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!