File Exchange

image thumbnail

fitVirusCV19_state (United States COVID-19 SIR Model)

version 1.2.6 (4.5 MB) by JM2
Estimation of coronavirus COVID-19 epidemic evaluation by the SIR model, Code receives and plots data for the US obtained over the web.


Updated 30 Apr 2020

View Version History

View License

This code will retrieve recent state-level data from Wikipedia and attempts to fit it to a SIR model using structure created by Milan Batista.( 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.

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


The plot may be enabled or disabled via (default is on):

To plot the growth rate on the figure use (def value is 2)

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

Cite As

JM2 (2021). fitVirusCV19_state (United States COVID-19 SIR Model) (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (2)

Ying Liu

James Brooks

Thanks! In order to get this to work on 2018a, I needed to modify urlreadtable, line 60 to be:
aux = (regexprep(mytable{z}{1,:},'\W',''))

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

Inspired by: CoronavirusDataByState, URL Read Table, fitVirusCOVID19

Community Treasure Hunt

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

Start Hunting!