how to get eigenvalues of a function matrix?

조회 수: 1 (최근 30일)
reza hamzeh
reza hamzeh 2019년 12월 20일
답변: Bjorn Gustavsson 2019년 12월 20일
hi
suppose we have with function H=@(x)[x/2,0,0,0;0,-x/2,x,0;0,x,-x/2,0;0,0,0,x/2];
how to get igenvalues and igenvectors of this matrix? eig(H) gives this error ==> Undefined function 'eig' for input arguments of type
'function_handle'.
what i can to do ? plz help me

채택된 답변

Bjorn Gustavsson
Bjorn Gustavsson 2019년 12월 20일
To calculate the eigenvalues of H you have to chose, either to use your implementation where H is a handle to a function returning an ordinary matrix if you feed it an input argument. This for example works fine:
eig(H(3))
Since:
H(3)
returns a matrix:
ans =
1.5000 0 0 0
0 -1.5000 3.0000 0
0 3.0000 -1.5000 0
0 0 0 1.5000
That has some eigenvalues. Or you could go with symbolic calculations:
syms x;
eig([x/2,0,0,0;0,-x/2,x,0;0,x,-x/2,0;0,0,0,x/2])

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Linear Algebra에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by