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

Community Treasure Hunt

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

Start Hunting!

Translated by