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!