Error in Eigen Values

조회 수: 24 (최근 30일)
Virna Silitonga
Virna Silitonga 2020년 7월 1일
댓글: Walter Roberson 2020년 7월 8일
I have problem to find the eigen values of two matrix
KS(stiffness matrix) ; KG(geometric matrix)
KSr = KS(iDE,iDE);
KGr = KG(iDE,iDE);
[V,D]=eigs(KSr,KGr,1,'SM');
I get the following error:
Error using eigs/checkInputs (line 431)
A must be a double matrix or a function.
Error in eigs (line 93)
[A,Amatrix,isrealprob,issymA,n,B,classAB,k,eigs_sigma,whch, ...
Error in Critical_Buckling (line 435)
[V,D]=eigs(KSr,KGr,1,'SM');
Question: How i can solve this problem on my program?

답변 (1개)

John D'Errico
John D'Errico 2020년 7월 1일
Is KSr a double precision matrix, or a function, in the form of a function handle, or the name of an m-file function? That seems unlikely, sicne you create KSr from what seems to be another matrix KS.
Or, is it possible that you have created a symbolic problem, with some symbolic unknowns inside that matrix?
The one thing that we know for sure about your problem is it is NOT true that
A IS a double matrix or a function.
Eigs CANNOT be used on symbolic problems. For example, I can virtually replicate the error you get in a simple way.
A = sym(magic(3));
>> B = sym(eye(3));
>> eigs(A,B,1,'sm')
Error using eigs>checkInputs (line 214)
First argument must be a double matrix or a function.
Error in eigs (line 90)
innerOpts, randStr, useEig, originalB] = checkInputs(varargin{:});
which is essentially the same, though may possibly come from a different MATLAB release, since the wording of the message seems different.
  댓글 수: 6
Walter Roberson
Walter Roberson 2020년 7월 8일
I missed that you are using generalized eigenvalue. Unfortunately symbolic eig() does not handle generalized eigenvalue.
There is, by the way, a performance trick for eig() on symbolic square matrix A:
T = sym('T', size(A));
mask0 = isAlways(A==0, 'Unknown', false);
mask1 = isAlways(A==1, 'Unknown', false);
T(mask0) = 0;
T(mask1) = 1;
[V, D, P] = eig(T);
mask2 = ~(mask0 | mask1);
vars = T(mask2);
Avals = A(mask2);
AV = subs(V, vars, Avals);
AD = subs(D, vars, Avals);
AP = subs(P, vars, Avals);
Those subs will not be fast! However, they will probably be faster that doing eig() on a matrix with expressions in it.
The eig() could potentially be sped up by retaining any entries that are simple constants.
Walter Roberson
Walter Roberson 2020년 7월 8일
I re-tried running eig() on a pure 5 x 5 symbolic matrix. After about 16 or so hours, it was using more than 100 gigabytes of memory, so I had to kill it.
eig() on a 4 x 4 symbolic matrix takes less than 2 seconds and is quite practical. On a 5 x 5 or larger, you need a big system and a lot of time to compute it.
eig() of a 5 x 5 matrix would be the roots of the characteristic polynomial (in theory) and so likely cannot be explicitly written out anyhow as that would be roots of a quintic.

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

카테고리

Help CenterFile Exchange에서 Linear Algebra에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by