How to iterate fixed points values in order to print all eigenvalues in lokta-volterra model

2 ビュー (過去 30 日間)
carlos ruiz
carlos ruiz 2019 年 10 月 4 日
回答済み: Shubh Sahu 2019 年 10 月 7 日
All I want is to be able to print on the console all possible eigenvalues ​​from the fixed points obtained, without having to change P value manually.
This is what I have so far, and it works.
Thank you
function stationary()
g1 = 1.2;
g2 = 0.2;
g11 = 3;
g12 = 8;
g21 = 1;
g22 = 6;
%Fixed Points
syms x y
eqn1 = g1*(1-g11*x-g12*y)*x == 0;
eqn2 = -g2*(1-g21*x+g22*y)*y==0;
sol = solve([eqn1, eqn2], [x, y]);
xFP = sol.x;
yFP = sol.y;
%Jacobian matrix
F= [g1*(1-g11*x-g12*y)*x, g2*(1-g21*x+g22*y)*y];
V= [x y];
J=jacobian(F,V);
%Jacobian matrix evaluated in a specific fixed point
P= [1 1];%----->so far this is manual been all possible options [(0,0), (0,1), (1,0), (1,1)]
jnew=subs(J,V,P);
%Eigenvalues
Eig= eig(jnew);
disp(Eig)%------->I want to display all Eig with all posible fixed points (P)
%Plotting the equations
x = 0:10;
line1 = (1-g11*x)/g12;
line2 = (g21*x-1)/g22;
plot (x, line1, x, line2)

回答 (1 件)

Shubh Sahu
Shubh Sahu 2019 年 10 月 7 日
Hello Carlos,
Hope this will work for you
function stationary()
g1 = 1.2;
g2 = 0.2;
g11 = 3;
g12 = 8;
g21 = 1;
g22 = 6;
%Fixed Points
syms x y
eqn1 = g1*(1-g11*x-g12*y)*x == 0;
eqn2 = -g2*(1-g21*x+g22*y)*y==0;
sol = solve([eqn1, eqn2], [x, y]);
xFP = sol.x;
yFP = sol.y;
%Jacobian matrix
F= [g1*(1-g11*x-g12*y)*x, g2*(1-g21*x+g22*y)*y];
V= [x y];
J=jacobian(F,V);
%Jacobian matrix evaluated in a specific fixed point
for i=0:1
for j=0:1
P=[i j]; %----> possible options
jnew=subs(J,V,P);
Eig= eig(jnew);
disp(Eig);%------->displaying all Eig with all posible fixed points (P)
end
end
%Plotting the equations
x = 0:10;
line1 = (1-g11*x)/g12;
line2 = (g21*x-1)/g22;
plot (x, line1, x, line2)

カテゴリ

Help Center および File ExchangeLinear Algebra についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by