Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

MATHEMATICAL BIOLOGY: I am trying to use MATLAB to code my predator-prey equatio

ID: 3840877 • Letter: M

Question

MATHEMATICAL BIOLOGY: I am trying to use MATLAB to code my predator-prey equations and plot them over time. (Lotka-Volterra model with extension of carrying capacity for prey) (you can use your own reasonable numbers for the variables/parameters in order to run the model). Please use MATLAB to code the following:

prey: dx/dt=rx(1-x/k)-axy

predator: dy/dt=caxy-qy

where x is the prey population, y is the predator population, t is time, r is the growth rate of prey,

a is the searching efficiency/attack rate of the predator, q is the predator mortality rate,

c is the predator efficiency at turning food into offspring (conversion efficiency),

and k is the carrying capacity of the prey.

Explanation / Answer

clear
clc
r=9;
a=7;
q=6;
c=5;
k=6;
f=@(t,x)[r*x(1)*(1-x(1)/k)-a*x(1)*x(2);c*a*x(1)*x(2)-q*x(2)];
[t,xa] = ode45(f,[0 10],[60 22]);%[60 22] represents the initial condition, change it as needed
%first column of xa corresponds to x, other to y
plot(t,xa(:,1),'b')%responds to x,blue
hold
plot(t,xa(:,2),'r')%responds to y,red