How to get roots from eig function?

6 次查看(过去 30 天)
Jaemon Hon
Jaemon Hon 2020-12-19
回答: Anay 2025-2-20
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)

回答(1 个)

Anay
Anay 2025-2-20
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!

类别

Help CenterFile Exchange 中查找有关 Linear Algebra 的更多信息

产品


版本

R2013a

Community Treasure Hunt

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

Start Hunting!

Translated by