Eigenvalues in symbolic matrix
19 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
sara
el 30 de Nov. de 2022
Comentada: sara
el 30 de Nov. de 2022
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 comentarios
Respuesta aceptada
Torsten
el 30 de Nov. de 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])
Más respuestas (0)
Ver también
Categorías
Más información sobre Linear Algebra en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!