- #1
jhox08
- 8
- 0
Homework Statement
consider the Lotka-Volterra predator prey model defined by dx/dt=-0.1x+0.02xy and dy/dt=0.2y-0.025xy, x(t) is predators and y(t) is prey...us a numerical solver to graph x(t) and y(t)
Homework Equations
x(0)=6, y(0)=6
The Attempt at a Solution
here's my code, I honestly don't know if its right, but when I try to run it I get an error of Maximum recursion limit of 500 reached, can someone help me out with this, I'm not very good with Matlab, any advise would be great...thanks
function dp=pred(t,y)
clear;
g=0.2; d1=0.025; d2=0.1; c=0.02; y(1)=6; y(2)=6;
[T,Y]=ode45(@pred, [0,5],[6 6]);
dp=[g*y(1)-d1*y(1)*y(2); -d2*y(2)+c*y(1)*y(2)];
plot(T,Y(:,1),'-',T,Y(:,2),'--');