Lotka volterra phase portrait MATLAB

35 visualizaciones (últimos 30 días)
Beth
Beth el 15 de Feb. de 2015
Respondida: Mahdiar Sadeghi el 6 de Feb. de 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 comentario
Matthew Worker
Matthew Worker el 30 de Nov. de 2017
Hello have you received an answer for this yet?

Iniciar sesión para comentar.

Respuestas (1)

Mahdiar Sadeghi
Mahdiar Sadeghi el 6 de Feb. de 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.

Categorías

Más información sobre Ordinary Differential Equations en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by