Eigenvalues in symbolic matrix
Show older comments
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;
Accepted Answer
More Answers (0)
Categories
Find more on Sparse Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!