MATLAB Answers

Error in Eigen Values

11 ビュー (過去 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);
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)
Question: How i can solve this problem on my program?

  0 件のコメント

Sign in to comment.

回答 (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 件のコメント

表示 3 件の古いコメント
Virna Silitonga
Virna Silitonga 2020 年 7 月 8 日
Ohh i see.. thank you so much
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.

Sign in to comment.

Translated by