Get non-zero eigenvalues and eigenvectors
13 ビュー (過去 30 日間)
古いコメントを表示
I am simply looking to retrieve non-zero eigenvalues (and eigenvectors which correspond to them) from a matrix X. I am new to matlab and the eig() and eigs() functions don't seem to do what I want. How do I solve this?
2 件のコメント
回答 (1 件)
Christine Tobler
2018 年 11 月 26 日
You could just remove the zero eigenvalues after computing them:
>> X = [1 1; 1 1]
X =
1 1
1 1
>> [V,l] = eig(X, 'vector')
V =
-0.7071 0.7071
0.7071 0.7071
l =
0
2
>> l == 0
ans =
2×1 logical array
1
0
>> V(:, l==0) = []
V =
0.7071
0.7071
>> l(l==0) = [];
l =
2
In practice, l==0 should probably be replaced by abs(l) < tol.
0 件のコメント
参考
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!