how to get eigenvalues of a function matrix?

2 Ansichten (letzte 30 Tage)
reza hamzeh
reza hamzeh am 20 Dez. 2019
Beantwortet: Bjorn Gustavsson am 20 Dez. 2019
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

Akzeptierte Antwort

Bjorn Gustavsson
Bjorn Gustavsson am 20 Dez. 2019
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])

Weitere Antworten (0)

Kategorien

Mehr zu Linear Algebra finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by