version 2.1.2 (3.47 MB) by milan batista
Estimation of coronavirus COVID-19 epidemic size by the logistic model


Updated 14 Apr 2020

View License

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

The function fitVirus03 implements a logistic model for estimation of epidemy final size from daily predictions. The model is data-driven, so its forecast is as good as data are. Also, it is assumed that the model is a reasonable description of the one-stage epidemic. If however, the epidemic evolves to the second phase the model becomes useless. The model is also useless to the initial epidemic phase.

The contribute contains data for coronavirus for Austria, Belgium, China, Croatia, Denmark, Germany, Hungary, France, Iran, Italy, Lombardia, Norway, Netherlands, NY State, Portugal, Slovenia, South Korea, Spain, Switzerland, UK, USA and data for outside of China (up to 24.Mar.2020)

The regression convergence may fail for a pure initial guess or small data set. Therefore the method does not apply to the early stages of an epidemic. Also, results are useless if regression statistic does not meet minimum criteria, say R^2 > 0.8, p-value < 0.05.

On the epidemy evaluation graph regions colors 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)

The second figure produced is the evaluation of daily epidemy size. If these values do not converge to a constant then epidemic is probably not yet stable.

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

A new version based on SIR model is available at

Data for other countries are available from

DISCLAIMER. Software and data are for education and not for medical or commercial use.

Cite As

milan batista (2022). fitVirus (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2019b
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!