필터 지우기
필터 지우기

How can i correct this error ?

조회 수: 1 (최근 30일)
Mallouli Marwa
Mallouli Marwa 2016년 9월 1일
댓글: Star Strider 2016년 9월 1일
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.
  댓글 수: 2
Adam
Adam 2016년 9월 1일
Clearly you need to give us more information on k and m. Judging from the error messages though it seems clear that one of your two inputs, k or m, are sparse matrices and these are not supported by Eig.
Mallouli Marwa
Mallouli Marwa 2016년 9월 1일

m=

   (1,1)                0.00075602592
   (3,1)                0.00013085064
   (4,1)              -8.00127432e-07
   (2,2)            1.25066072448e-08
   (3,2)               8.00127432e-07
   (4,2)            -4.6899777168e-09
   (1,3)                0.00013085064
   (2,3)               8.00127432e-07
   (3,3)                0.00037801296
   (4,3)             -1.354061808e-06
   (1,4)              -8.00127432e-07
   (2,4)            -4.6899777168e-09
   (3,4)             -1.354061808e-06
   (4,4)             6.2533036224e-09

And, k=

   (1,1)             28834278.0744617
   (3,1)            -14417139.0372308
   (4,1)             183097.665772832
   (2,2)             6200.90761417323
   (3,2)            -183097.665772832
   (4,2)             1550.22690354331
   (1,3)            -14417139.0372308
   (2,3)            -183097.665772832
   (3,3)             14417139.0372308
   (4,3)            -183097.665772832
   (1,4)             183097.665772832
   (2,4)             1550.22690354331
   (3,4)            -183097.665772832
   (4,4)             3100.45380708661

댓글을 달려면 로그인하십시오.

채택된 답변

Star Strider
Star Strider 2016년 9월 1일
According to the sparse matrix section of the documentation, you need to use the eigs function.
  댓글 수: 2
Mallouli Marwa
Mallouli Marwa 2016년 9월 1일
Have they the same result ?
Star Strider
Star Strider 2016년 9월 1일
They seem to, but the results of eig are ordered opposite those of eigs. The eigs funciton works with sparse matrices, while eig does not.
Check them with something like this example (not using sparse matrix arguments):
A = randi([-9 9], 5);
[V1,D1] = eig(A)
[V2,D2] = eigs(A)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Sparse Matrices에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by