How to get roots from eig function?

6 views (last 30 days)
Jaemon Hon
Jaemon Hon on 19 Dec 2020
Answered: Anay on 20 Feb 2025
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)

Answers (1)

Anay
Anay on 20 Feb 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!

Products


Release

R2013a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!