MATLAB: How can i correct this error

matlab function

Hi
In my program, i use the function eig to return the eigenvalues :
[V,D]=eig(k,m);
But i have obtained this error:
Error using eig
EIG does not support generalized eigenproblem EIG(A,B) when A or B is sparse.
Please help me.

Best Answer

According to the sparse matrix section of the documentation, you need to use the eigs function.