To get dominant eigen vector

60 ビュー (過去 30 日間)
Pannir Selvam Elamvazhuthi
Pannir Selvam Elamvazhuthi 2011 年 8 月 28 日
コメント済み: Savas Erdim 2021 年 4 月 6 日
In Matlab/Octave, [A B] = eig(C) returns a matrix of eigen vectors and a diagonal matrix of eigen values of C. Even though the values may be theoretically real, these are given to be complex with very low imaginary values. Due to this, the eigen values are not put in a decreasing order. Hence to find the eigen vectors corresponding to dominant eigen values, some calculations are required, which take up processing time in a big loop. Is there a remedy to this to find dominant eigen vectors?
  3 件のコメント
Pannir Selvam Elamvazhuthi
Pannir Selvam Elamvazhuthi 2011 年 8 月 29 日
I agree Bjorn. Thanks.
Pannir Selvam Elamvazhuthi
Pannir Selvam Elamvazhuthi 2011 年 8 月 29 日
But Chen's answer seems to be faster as directly I'd get the eigen value and the corresponding vector too.

サインインしてコメントする。

採用された回答

Chaowei Chen
Chaowei Chen 2011 年 8 月 28 日
[U,S,V]=svd(C) gives you the singular value decomposition of C. i.e., C=U*S*V'
where the singular values S are in decreasing order. Therefore, the most dominant eigenvector is U(:,1), for example.
  2 件のコメント
Pannir Selvam Elamvazhuthi
Pannir Selvam Elamvazhuthi 2011 年 8 月 29 日
Thanks Chen.
Illya
Illya 2014 年 7 月 14 日
Almost correct: SVD is works fine only for PSD case.
If C is not PSD, there is no way to use SVD to get eigenvectors. Even using svd(C*C) ou svd(C*C') will not produce correct eigenvectors. Try, for example,
C=[0 1 1;0 1 1;1 0 0];
first with eigs()
[V,D]=eigs(C);
lambda=D(1,1), v=V(:,1),
C*v-lambda*v
% lambda =
%
% 1.6180
%
%
% v =
%
% -0.6479
% -0.6479
% -0.4004
%
%
% ans =
%
% 1.0e-015 *
%
% 0.2220
% 0
% 0.4441
And then with svd():
[U,S,V]=svd(C); v=U(:,1)
C*v-lambda*v
% v =
%
% -0.7071
% -0.7071
% 0
%ans =
%
% 0.4370
% 0.4370
% -0.7071
or, even using squared a argument:
[U,S,V]=svd(C*C); v=U(:,1)
lambda=sqrt(S(1,1))
C*v-lambda*v
% v =
%
% -0.6280
% -0.6280
% -0.4597
%
%
% lambda =
%
% 1.6529
%
%
% ans =
%
% -0.0497
% -0.0497
% 0.1319
The squared version is much closer, but still far away from the right answer. The 'pseudo PSD' version (svd(C*C')) would produce the same U vectors as svd(C), which *is the eigenvector of C*C' but not an igenvector of C*.
However, all the above code would produce correct results for some PSD matrix, e.g. C1=C*C'.

サインインしてコメントする。

その他の回答 (2 件)

Riley Manfull
Riley Manfull 2018 年 2 月 9 日
[A,B]=eigs(C,1)
  1 件のコメント
Savas Erdim
Savas Erdim 2021 年 4 月 6 日
That worked very well. Thank you Riley!

サインインしてコメントする。


Christine Tobler
Christine Tobler 2017 年 5 月 12 日
I realize this is an old post, but this might be helpful to others:
One reason for EIG to return complex values with very small imaginary part, could be that A is very close to, but not exactly, symmetric. In this case,
[U, D] = eig( ( A + A')/2 );
will make EIG treat the input as symmetric, and always return real eigenvalues.

カテゴリ

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