How to get roots from eig function?
7 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
clc; clear all;
syms p
d = 8 - p^2; dp = -4; dm = -4;
Matrix = [d dp 0 0 0;dm d dp 0 0;0 dm d dp 0;...
0 0 dm d dp;0 0 0 dm d];
disp(Matrix)
Determinant = det(Matrix)
e = eig(Matrix); disp(e)
% p = -2,2,-2.828,2.828,-3.464 (result of solving e)
I want to get p, which is the result of solving e
How to get the root of the function?
Previously, I tried to use this, but couldn't
e = eig(solve(Matrix)); disp(e)
0 commentaires
Réponses (1)
Anay
le 20 Fév 2025
Hi Jaemon,
I understand that you are trying to find the values of “p” such that any eigen value becomes 0. If your goal is to find values of “p” that make any single eigenvalue zero (rather than all simultaneously), you should solve for each eigenvalue individually. You can refer to the following code to equate each eigen value to 0 and solve for “p”:
e = eig(Matrix);
% Iterate through each eigenvalue and solve for p
for i = 1:length(e)
roots = solve(e(i) == 0, p);
disp(['Roots for eigenvalue ', num2str(i), ':']);
disp(double(roots));
end
I hope this solves the issue!
0 commentaires
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!