Lotka volterra phase portrait MATLAB

36 Ansichten (letzte 30 Tage)
Beth
Beth am 15 Feb. 2015
Beantwortet: Mahdiar Sadeghi am 6 Feb. 2018
I'm confused by the quiver and ode45 functions used to plot phase portraits. I want you use MATLAB to plot the isoclines and closed phase plane trajectories to model the predator-prey Lotka-Volterra system of equations:
dx/dt=alpha * x - beta * x * y
dy/dt=delta * x * y - gamma * y
Thank you.
  1 Kommentar
Matthew Worker
Matthew Worker am 30 Nov. 2017
Hello have you received an answer for this yet?

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Mahdiar Sadeghi
Mahdiar Sadeghi am 6 Feb. 2018
Note that ode45 is gives the solution of Ordinary Differential Equations (ODE) over time with respect to its initial condition. While quiver displays velocity vectors as arrows with components (u,v) at the points (x,y). So one way of using MATLAB to plot phase portrait of the predator-prey Lotka-Volterra system can be (for the case α=β=δ=γ=1):
%specify the region of the plot for vector plot
[x1, x2] = meshgrid(-1:0.2:3, -1:.2:3);
x1dot = x1 - x2 .*x1; %Note the use of .* and .^
x2dot = x1 .* x2 - x2;
%first plot the vector plot with quiver
figure
quiver(x1,x2,x1dot, x2dot)
% predator-prey Lotka-Volterra system
f = @(t,y) [y(1) - y(1)*y(2); y(1)*y(2) - y(2)];
hold on
%calculate the phase trajectories for different initial conditions
for y0=0:.7:2.8
[ts, ys] = ode45(f,[0, 8], [y0/2, y0]);
% plot of closed loop phase trajectories
plot(ys(:,1), ys(:,2))
end
hold off
xlabel('x')
ylabel('y')
This UMD link might be helpful for further reading and examples.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by