Eigenvalues in symbolic matrix
19 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi all,
I'm running the following code to extract eigenvalues from a series of 3x3 symbolic matrices.
The rank of each matrices is 3 so I expect 3 eigenvalues, but I obtain only two eigenvalues.
What I'm doing wrong? Here the code:
Thanks for your help!
Sara
clc
clear all
N0=10/30.97;
vp=[60,50];
kp=[0.5,0.5];
gp=[0.45,0.45];
mp=[1/3/0.001512,1/3/0.001512];%mp=[1/3,1/3];
q=1/100;
rate=2/60;
syms P1 P2 N
[P1eq,P2eq,Neq]=solve([gp(1)*vp(1)./(kp(1)+N0)*N*P1 - mp(1)*P1^2==0, ...
gp(2)*vp(2)./(kp(2)+N0)*N*P2 - mp(2)*P2^2==0, ...
- rate*(N-N0) - q*vp(1)/(kp(1)+N0)*N*P1 - q*vp(2)/(kp(2)+N0)*N*P2==0], [P1,P2,N]);
%% 2.stability analysis
J=jacobian([gp(1)*vp(1)./(kp(1)+N0)*N*P1 - mp(1)*P1^2==0, ...
gp(2)*vp(2)./(kp(2)+N0)*N*P2 - mp(2)*P2^2==0, ...
- rate*(N-N0) - q*vp(1)/(kp(1)+N0)*N*P1 - q*vp(2)/(kp(2)+N0)*N*P2==0], [P1,P2,N]);
%evaluates jacobian in each point
lambda=[];
for i=1:length(P1eq)
M=subs(J,[P1,P2,N],[P1eq(i,1),P2eq(i,1),Neq(i,1)]);
lambda=[lambda;eig(M)'];
end
return;
0 commentaires
Réponse acceptée
Torsten
le 30 Nov 2022
Replace
%% 2.stability analysis
J=jacobian([gp(1)*vp(1)./(kp(1)+N0)*N*P1 - mp(1)*P1^2==0, ...
gp(2)*vp(2)./(kp(2)+N0)*N*P2 - mp(2)*P2^2==0, ...
- rate*(N-N0) - q*vp(1)/(kp(1)+N0)*N*P1 - q*vp(2)/(kp(2)+N0)*N*P2==0], [P1,P2,N]);
by
%% 2.stability analysis
J=jacobian([gp(1)*vp(1)./(kp(1)+N0)*N*P1 - mp(1)*P1^2, ...
gp(2)*vp(2)./(kp(2)+N0)*N*P2 - mp(2)*P2^2, ...
- rate*(N-N0) - q*vp(1)/(kp(1)+N0)*N*P1 - q*vp(2)/(kp(2)+N0)*N*P2], [P1,P2,N])
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Linear Algebra 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!