How do I find the eigenvalues and vectors of an equation not of form (A*x = b*x)?

16 views (last 30 days)
I'm trying to solve a vibrations problem in which my eigenvalue equation is K*x = b*M*x, where K and M are matrices and b is a scalar. I can do this by hand for low dimensional problems, but it gets to be way too much after more than 2-3 degrees of freedom are introduced.
Is there a built in command to do this? K and M are symbolic matrices.
  1 Comment
Jeffrey Clark
Jeffrey Clark on 1 Oct 2022
@Edward Walker, as indicated in the tips documentation the symbolic eig function does not support solving the generalized eigenvalue problem (with two input arguments). To solve the generalized eigenvalue problem, use the MATLAB eig function instead by converting the input matrices to a MATLAB numeric type. As in this varient:
[V,D,W] = eig(A,B) also returns full matrix W whose columns are the corresponding left eigenvectors, so that W'*A = D*W'*B

Sign in to comment.

Answers (2)

Torsten
Torsten on 1 Oct 2022
Multiply be inv(M) and use eig as
lambda = eig(inv(M)*K)

John D'Errico
John D'Errico on 1 Oct 2022
Edited: John D'Errico on 1 Oct 2022
This is a classic problem in eigenvalues, caled the generalized eigenvalue problem. That is, if you want to solve the eigenproblem
A*x = lambda*B*x
then eig solves it for you, directly.
help eig
EIG Eigenvalues and eigenvectors. E = EIG(A) produces a column vector E containing the eigenvalues of a square matrix A. [V,D] = EIG(A) produces a diagonal matrix D of eigenvalues and a full matrix V whose columns are the corresponding eigenvectors so that A*V = V*D. [V,D,W] = EIG(A) also produces a full matrix W whose columns are the corresponding left eigenvectors so that W'*A = D*W'. [...] = EIG(A,'nobalance') performs the computation with balancing disabled, which sometimes gives more accurate results for certain problems with unusual scaling. If A is symmetric, EIG(A,'nobalance') is ignored since A is already balanced. [...] = EIG(A,'balance') is the same as EIG(A). E = EIG(A,B) produces a column vector E containing the generalized eigenvalues of square matrices A and B. [V,D] = EIG(A,B) produces a diagonal matrix D of generalized eigenvalues and a full matrix V whose columns are the corresponding eigenvectors so that A*V = B*V*D. [V,D,W] = EIG(A,B) also produces a full matrix W whose columns are the corresponding left eigenvectors so that W'*A = D*W'*B. [...] = EIG(A,B,'chol') is the same as EIG(A,B) for symmetric A and symmetric positive definite B. It computes the generalized eigenvalues of A and B using the Cholesky factorization of B. [...] = EIG(A,B,'qz') ignores the symmetry of A and B and uses the QZ algorithm. In general, the two algorithms return the same result, however using the QZ algorithm may be more stable for certain problems. The flag is ignored when A or B are not symmetric. [...] = EIG(...,'vector') returns eigenvalues in a column vector instead of a diagonal matrix. [...] = EIG(...,'matrix') returns eigenvalues in a diagonal matrix instead of a column vector. See also CONDEIG, EIGS, ORDEIG. Documentation for eig doc eig Other uses of eig codistributed/eig gpuArray/eig sym/eig symbolic/eig DynamicSystem/eig
Do you see that one of the options allows you to provide TWO matrices? All you need to do is:
[V,D] = eig(K,M);
Of course, if the matrix M is non-singular, then it is equivalent to writing the problem as
inv(M)*K*x = lambda*x
So then you could use eig simply as
[V,D] = eig(inv(M)*K);
In general, it is better to avoid the matrix inverse computation, so just use the generalized eigenvalue solver you already have in the form of eig(K,M).

Categories

Find more on Eigenvalues & Eigenvectors 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!