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.
ode_predator_prey ( [ pred, prey ], [ t0, t_max ] )where
The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.
ODE_PREDATOR_PREY is available in a MATLAB version.
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.
You can go up one level to the MATLAB source codes.