how to get eigenvalues of a function matrix?
1 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
采纳的回答
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 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!