Eigenvalues of pair of two large matrices
2 views (last 30 days)
Show older comments
Hi All,
In my FEM code I have two square matrices (Mass and Stiffness matrices). Both are symmetric and more populated near the diagonal. Since they are quite large, the EIG command consumes a lot of time.
Is there any command that can shorten the time and compute first 10 or 30 frequencies only.
Best regards, Rehan Jamshed
0 Comments
Answers (2)
Matt J
on 6 Jan 2016
Edited: Matt J
on 8 Jan 2016
Your K and M matrices, in addition to having a very pretty snow-flake pattern, both appear to be Kronecker products of a 5x5 matrix with a 243x243 matrix.
>> spy(M)
If that is indeed the case, you can make the computation even more efficient by using the EIG method in my KronProd class ( Download ). The class doesn't have an eigs() method, so you are forced to find all the eigenvectors and eigenvalues. Nevertheless, the whole thing is 10 times faster on my machine than [A,B]=eigs(sparse(K),sparse(M),10).
Kx=rand(5); Ky=rand(243);
Mx=rand(5); My=rand(243);
K=KronProd({Ky,Kx});
M=KronProd({My,Mx});
tic;
[A,B]=eig(K,M);
toc
%Elapsed time is 0.097657 seconds.
5 Comments
See Also
Categories
Find more on Sparse Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!