How to iterate fixed points values in order to print all eigenvalues in lokta-volterra model
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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)
0 Kommentare
Antworten (1)
Shubh Sahu
am 7 Okt. 2019
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)
0 Kommentare
Siehe auch
Kategorien
Mehr zu Linear Algebra finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!