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