Error in Eigen Values

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 个)

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 个评论

I'm sorry for my late reply, thanks before..
KSr is a matrix, I'm trying to find a solution of critical temperature problem of the beam.
KSr has a variable in it, is it possible in matlab to find the eigenvalue of a matrix that still has a variable?
And
I found this while my file running,
... Output truncated. Text exceeds maximum line length of 25,000 characters for Command Window display.
Does it mean the results are already there but cannot be displayed? or data can't be processed because it's too much?
oh and I tried to run the problem that you demonstrated in a simple way to see the results whether is it the same error as mine. And the errors like this:
Error in eigs (line 93)
[A,Amatrix,isrealprob,issymA,n,B,classAB,k,eigs_sigma,whch, ...
i really don't know what to do..
eigs() cannot be used with Symbolic expressions.
eig() can be used with Symbolic expressions, but it gets unbearably slow beyond 4 x 4 matrices, and the solutions it gives you seldom have any practical use.
Ohh i see.. thank you so much
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.
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.

请先登录,再进行评论。

类别

Community Treasure Hunt

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

Start Hunting!

Translated by