Eigenvalue computation for large matrix
2 ビュー (過去 30 日間)
古いコメントを表示
Hi there -
I want to compute the eigenvalues of the matrix (1/T)*A'A, where A is a Txn matrix.
Here is my code:
T = 5;
n = 4;
A = randn(T,n);
c = T\(A'*A);
c1 = T\A'*A;
[W, lambda] = eig(c); % columns of W contain eigenvectors
[W1, lambda1] = eig(c1); % columns of W contain eigenvectors
Clearly, c and c1 are the same matrices since I'm only premultiplying the scalar (1/T). However, the eigenvalues in lambda are in different ordering than those in lambda1. Moreover, if I set
T = 50
n = 450
the elements in lambda1 become complex while those in lambda remain real.
I'd very much appreciate if somebody could help me out here and let me know what I'm missing.
Thanks, Peter
0 件のコメント
回答 (1 件)
Torsten
2016 年 7 月 19 日
For the problem with complex eigenvalues, see what happens if you set c1=0.5*(c1+c1') before calling "eig".
Best wishes
Torsten.
1 件のコメント
Peter
2016 年 7 月 19 日
編集済み: Peter
2016 年 7 月 19 日
In this case the eigenvalues become real and the ordering in lambda and lambda1 also coincide.
It seems to be a numerical problem in the computation of c1 that screws up the symmetry of that matrix and, in turn, the eigenvalues. Do you have any idea why this is so? I'm not exactly a numerical wizard, but I guess it's related to building the inverse of T.
Thanks!
参考
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!