Lotka volterra phase portrait MATLAB

조회 수: 35 (최근 30일)
Beth
Beth 2015년 2월 15일
답변: Mahdiar Sadeghi 2018년 2월 6일
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
Matthew Worker
Matthew Worker 2017년 11월 30일
Hello have you received an answer for this yet?

댓글을 달려면 로그인하십시오.

답변 (1개)

Mahdiar Sadeghi
Mahdiar Sadeghi 2018년 2월 6일
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.

카테고리

Help CenterFile Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by