sir_ode, a MATLAB code which sets up and solves the ordinary differential equations (ODE) which simulate the spread of a disease using the Susceptible/Infected/Recovered (SIR) model.

We consider the evolution of a disease epidemic in a population of N people.

We assume that the patients can be classified as Susceptible, Infected or Recovering, with the properties that:


The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.


sir_ode is available in a MATLAB version and an Octave version and a Python version..

Related Data and codes:


matlab_ode, MATLAB codes which set up various ordinary differential equations (ODE).


  1. Dianne OLeary,
    Models of Infection: Person to Person,
    Computing in Science and Engineering,
    Volume 6, Number 1, January/February 2004.
  2. Dianne OLeary,
    Scientific Computing with Case Studies,
    SIAM, 2008,
    ISBN13: 978-0-898716-66-5,
    LC: QA401.O44.

Source Code:

Last revised on 27 October 2020.