plotting predator-prey model and its phase portrait
Show older comments
I have derived the eignevalues and eigenvectors of the predator prey model using symbolic notation. However, I am unable to plot the givn solution in the form it is given. Is it necessary to provide with values for the chosen variables in order to plot them?
syms A B D G t positive
syms x y x0 y0
assumeAlso([x0 y0], 'positive')
%The matrix dX/dt = f(X) is represented by F
F = [A*x - B*x*y; -G*y + D*x*y]
%The matrix v is used to denote the variables in focus
v = [x y]
%Now we find the Jacobian of F to approximate the given system about
% its stationary points. Through hand calculation, we know that the
% stationary points of the given system are: (0,0) and (G/D, A/B)
% This is represented by J1 and J2.
P1 = [0 0];
P2 = [G/D A/B];
j = jacobian(F, v)
J1 = subs(j,v,P1)
J2 = subs(j,v,P2)
%Now, we compute the eigenvalues and eigenvectors about the given points to
%determine the stability of the system. We know that, for a system to be
%stable, the eigenvalues of the system all have real part < 0
[T1, D1] = eig(J1)
[T2, D2] = eig(J2);
%T1 and T2 are eigenvectors while D1 and D2 are eigenvalues.
%In order to compute the phase portrait, we utilize x(t) = T*e^(Dt)*T^(-1)*x(0).
%For each case of stationary point, we get a different transformation
%matrix (i.e. A) and thus we find different x(t) for each case.
D1(t) = D1*t
D2(t) = D2*t
T1inv = inv(T1)
T2inv = inv(T2)
eD1(t) = exp(D1)
eD2(t) = exp(D2)
c1(t) = T1*eD1(t)*T1inv;
c2(t) = T2*eD2(t)*T2inv;
xt1(t) = c1(t)*[x0; y0]
xt2(t) = c2(t)*[x0; y0]
Can I plot it in terms of A,B,D and G?
Thanks
Accepted Answer
More Answers (0)
Categories
Find more on Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!