Iecm
Iecm
Numerical analysis also involves characterizing the convergence, accuracy, stability, and
computational complexity of these methods.
The variables x and y measure the sizes of the prey and predator populations, respectively.
The quadratic cross term accounts for the interactions between the species.
Let’s solve it in MATLAB using variable step size Runge-Kutta (RK) integration methods in
two different ways:
1. ode23: method uses a 2nd and 3rd order pair of formulas for medium accuracy
2. ode45: method uses a 4th and 5th order pair for higher accuracy
In this example, the equations are contained in a file called lotka.m. This file uses
parameter values of α=0.01 and β=0.02.
Create an ode object to define the problem and initial conditions. Use an initial condition of
x(0)=y(0)=20 so that the populations of predators and prey are initially equal.
Then use the solve method to simulate the system over the time interval 0<t<15.
Solve the system a second time using the ode45 solver, instead of ode23. The ode45
solver takes longer for each step, but it also takes larger steps.