How to iterate fixed points values in order to print all eigenvalues in lokta-volterra model
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (1)
Shubh Sahu
le 7 Oct 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 commentaires
Voir également
Catégories
En savoir plus sur Calculus dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!