ODE_PREDATOR_PREY
ODE Solution of a Predator Prey System


ODE_PREDATOR_PREY is a MATLAB program which applies the ODE23 function to estimate solutions of a pair of ordinary differential equations that model the behavior of a pair of predator and prey populations.

The physical system under consideration is a pair of animal populations.

The PREY reproduce rapidly; for each animal alive at the beginning of the year, two more will be born by the end of the year. The prey do not have a natural death rate; instead, they only die by being eaten by the predator. Every prey animal has 1 chance in 1000 of being eaten in a given year by a given predator.

The PREDATORS only die of starvation, but this happens very quickly. If unfed, a predator will tend to starve in about 1/10 of a year. On the other hand, the predator reproduction rate is dependent on eating prey, and the chances of this depend on the number of available prey.

The resulting differential equations can be written:

        PRED(0) = 5000         
        PREY(0) =  100
  
        d PREY / dT =    2 * PREY(T) - 0.001 * PREY(T) * PRED(T)
        d PRED / dT = - 10 * PRED(T) + 0.002 * PREY(T) * PRED(T)
      
Here, the initial values (5000,100) are a somewhat arbitrary starting point.

The pair of ordinary differential equations that result have an interesting behavior. For certain choices of the interaction coefficients (such as those given here), the populations of predator and prey will tend to a periodic oscillation. The two populations will be out of phase; the number of prey will rise, then after a delay, the predators will rise as the prey begins to fall, causing the predator population to crash again.

In this program, the pair of ODE's is solved by calling MATLAB's ODE23 function.

Usage:

ode_predator_prey ( [ pred, prey ], [ t0, t_max ] )
where The program uses ODE23 to estimate the solution from T0 to T_MAX, and displays a plot of the pair of solution curves.

Licensing:

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

Related Data and Programs:

DFIELD8, a MATLAB program which interactively displays the direction field of a differential equation, by John Polking.

FD_PREDATOR_PREY, a MATLAB program which solves a pair of predator prey ODE's using a finite difference approximation.

FD1D_PREDATOR_PREY, a MATLAB program which implements a finite difference algorithm for predator-prey system with spatial variation in 1D.

FD2D_PREDATOR_PREY, a MATLAB program which implements a finite difference algorithm for a predator-prey system with spatial variation in 2D.

PPLANE8, a MATLAB program which interactively displays the phase plane of a differential equation, by John Polking.

Reference:

  1. George Lindfield, John Penny,
    Numerical Methods Using MATLAB,
    Second Edition,
    Prentice Hall, 1999,
    ISBN: 0-13-012641-1,
    LC: QA297.P45.

Source Code:

Examples and Tests:

You can go up one level to the MATLAB source codes.


Last revised on 13 November 2009.