Error in Eigen Values
22 views (last 30 days)
Show older comments
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?
0 Comments
Answers (1)
John D'Errico
on 1 Jul 2020
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 Comments
Walter Roberson
on 8 Jul 2020
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
on 8 Jul 2020
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.
See Also
Categories
Find more on Linear Algebra 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!