Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

Too many input arguments using EIG function

Status
Not open for further replies.

Stringmaker

Mechanical
Mar 18, 2005
513
0
0
US
I have a simple eigenvalue problem I'm needing to solve. I'm using R14. Here is my m-file input:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
syms A E L p

% Stiffness matrix
K = ((A*E)/(15*L))*[35 -40 5;
-40 80 -40;
5 -40 35]

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% CONSISTENT MASS METHOD
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Consistent mass matrix
Mc = p*A*L*[2/15 -1/6 7/15;
-1/6 1/3 -1/2;
7/15 -1/2 32/15]

eig(K,Mc)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

When matlab tries to evaluate for the generalized eigenvalues it gives me the dreaded "??? Error using ==> sym.eig Too many input arguments." error. My first suspicion is that it can't handle all of the parameters such as p, A, E, and L that I've premultiplied K and Mc by. Does anyone have a suggestion of what a better approach may be?

Thank you!
 
Replies continue below

Recommended for you

" My first suspicion is that it can't handle all of the parameters such as p, A, E, and L that I've premultiplied K and Mc by"

Yes.

" Does anyone have a suggestion of what a better approach may be?"

I would do that one by hand if you are after a general expression.

[peace]
Fe
 
Matlab knows nothing about vibration. It is solving a standard eigenvalue problem. You need to reformulate as eigenvalue problem and feed it one matrix. For example
eig(inv(Mc)*K)

Then your eignevalues will be w^2

Also I'm not sure but you may need to declare M and K as syms

=====================================
Eng-tips forums: The best place on the web for engineering discussions.
 
Just to back up a bit.
The standard eigenvalue problem is [A-Lambda*I] x = 0
Matlab is expecting you to feed it A (it doesn't know what the heck M and K are!)

You have
w^2 M * X = K*X
w^2*X = Minv * K * X
(Minv*K – w^2*I)X = 0
This is in the same standard eigenvalue form as above with
A = Minv*K
Lambda = w^2

=====================================
Eng-tips forums: The best place on the web for engineering discussions.
 
I don't know about the symbolic toolbox overloaded version, but eig(K,M) is a valid matlab expression numerically. I use it all the time. It calculates the eigenvalues of K w.r.t. M.

i.e. such that

[K]*[phi]=[lambda][M][phi]

M

--
Dr Michael F Platten
 
I may be misunderstanding the term "generalized", but...

I would think that the "general" eigenvalue formulation takes a single argument A.

Anything that takes two arguments M and K would be a special application to vibration. It is a very small subset of the possible uses of eigenvalues.


=====================================
Eng-tips forums: The best place on the web for engineering discussions.
 
I'm no numerical linear algebra expert, but I think by leaving it in the generalised eigenvalue form (see my 1st post), the eigenvalue calculation is much quicker (so long as the 2 matrices are symmetric) because Cholesky factorisation can be used and no inversion of the mass matrix is necessary. It probably makes next to no difference for a 3x3 matrix though.

Anyway, electricpete, it appears the answer to the question of how to do it symbolically is the one you originally suggested. It appears that the backslash operator is not applicable to symbolic objects and you are reduced to using the inv() function and using the simple rather than generalised eigenvalue solver.

M

--
Dr Michael F Platten
 
For symbolic;
I recommend the alternative software Maple.
It should be able to perform this problem very quickly.

In Matlab, as the others have indirectly mentioned, a numerical approach is solvable.

Do it by hand and then correlate the answer you get...

[peace]
Fe
 
In Matlab, as the others have indirectly mentioned, a numerical approach is solvable.
It can be solved in Matlab symbolically as discussed above: eig(inv(Mc)*K)

Also as previously discussed, the symbolic form of eig accepts one and only one argument corresponding to A... which is perfectly logical to me. The fact that there is any general eigenvalue routine not tailored to vibration that directly accepts M and K matrices is a surprise to me, but apparently fairly common. Personally I will stick with straightforward single argument A so I know exactly what it's doing in accordance with the unambiguous universal defintion of eigenvalue... without having to dig inot the reference information to figure out which one goes first (M or K) in order to determine whether my eigenvalue is going to be w^2 or 1/w^2.

By the way, my ancient version of Maple (Maple V version 4) doesn't do symbolic eigenvalues. It does do numeric eigenvalues... and does accept one or two matrix arguments.

=====================================
Eng-tips forums: The best place on the web for engineering discussions.
 
By the way, my ancient version of Maple (Maple V version 4) doesn't do symbolic eigenvalues.
I should clarify... it doesn't have a function built in for this. But it is trivial excercize in Maple to build a symboic matrix A-Lambda*I, then compute the determinant, the find the values of Lambda where determinant is 0 (the eigenvalues).. all done symbolically.

=====================================
Eng-tips forums: The best place on the web for engineering discussions.
 
I didn't mean to contradict.
I just thought it would be easier if the OP did it in Maple.

Personally, I don't like the Matlab symbolic toolbox. The one I use has such a large computation time for even simple problems. (don't get me wrong, I use Matlab for almost everything else)

Anyways, I don't see why one would not do it by hand still.
(unless we are talking about a 5by5 ect. eigenvalue problem)

[peace]
Fe
 
Thank you for the suggestions! I ended up using eig(inv(Mc)*K) to solve for the eigenvalues. This worked superbly and is a great work around. I'm programming a finite element eigenvalue solver. I find doing this symbolically keeps things more general and easier to use and book keep.

 
Status
Not open for further replies.
Back
Top