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 Center および File ExchangeLinear Algebra についてさらに検索

製品


リリース

R2013a

Community Treasure Hunt

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

Start Hunting!

Translated by