grazing_ode, a MATLAB code which sets up and solves a pair of ordinary differential equations (ODE) that model the populations of an edible plant, and the herbivore that grazes on it.

In some ways, this problem recalls the predator-prey or Lotka-Volterra ODE, but in this case, there is a stable attracting solution, and strictly positive starting points are gradually attracted to it.


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


grazing_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. Michael Thompson, Bruce Stewart,
    Nonlinear Dynamics and Chaos,
    Second Edition,
    Wiley, 2002,
    ISBN: 0-471-87645-3,
    LC: QA871.T47.

Source Code:

Last revised on 20 December 2020.