Eig (MATLAB Functions)
Eig (MATLAB Functions)
1 of 4
http://nf.nci.org.au/facilities/software/Matlab/techdoc/ref/eig.html
eig
Find eigenvalues and eigenvectors
Syntax
d = eig(A)
d = eig(A,B)
[V,D] = eig(A)
[V,D] = eig(A,'nobalance')
[V,D] = eig(A,B)
[V,D] = eig(A,B,flag)
Description
d = eig(A)
d = eig(A,B)
returns a vector containing the generalized eigenvalues, if A and B are square matrices.
Note If S is sparse and symmetric, you can use d = eig(S) to returns the eigenvalues of S. To
request eigenvectors, and in all other cases, use eigs to find the eigenvalues or eigenvectors of
sparse matrices.
produces matrices of eigenvalues (D) and eigenvectors (V) of matrix A, so that
A*V = V*D. Matrix D is the canonical form of A--a diagonal matrix with A's eigenvalues on the main
diagonal. Matrix V is the modal matrix--its columns are the eigenvectors of A.
[V,D] = eig(A)
If W is a matrix such that W'*A = D*W', the columns of W are the left eigenvectors of A . Use
[W,D] = eig(A.'); W = conj(W) to compute the left eigenvectors.
finds eigenvalues and eigenvectors without a preliminary balancing step.
Ordinarily, balancing improves the conditioning of the input matrix, enabling more accurate computation
of the eigenvectors and eigenvalues. However, if a matrix contains small elements that are really due to
roundoff error, balancing may scale them up to make them as significant as the other elements of the
original matrix, leading to incorrect eigenvectors. Use the nobalance option in this event. See the
balance function for more details.
[V,D] = eig(A,'nobalance')
[V,D] = eig(A,B,flag)
can be:
'chol'
Computes the generalized eigenvalues of A and B using the Cholesky factorization of B. This is
the default for symmetric (Hermitian) A and symmetric (Hermitian) positive definite B.
'qz'
Ignores the symmetry, if any, and uses the QZ algorithm as it would for nonsymmetric
(non-Hermitian) A and B.
Note For eig(A), the eigenvectors are scaled so that the norm of each is 1.0. For eig(A,B),
eig(A,'nobalance'), and eig(A,B,flag), the eigenvectors are not normalized.
26-10-2015 12:59
2 of 4
http://nf.nci.org.au/facilities/software/Matlab/techdoc/ref/eig.html
Remarks
The eigenvalue problem is to determine the nontrivial solutions of the equation
where
is an n-by-n matrix,
satisfy the equation are the eigenvalues, and the corresponding values of
MATLAB, the function eig solves for the eigenvalues
that
The generalized eigenvalue problem is to determine the nontrivial solutions of the equation
where both
and
Because
When a matrix has no repeated eigenvalues, the eigenvectors are always independent and the eigenvector
matrix V diagonalizes the original matrix A if applied as a similarity transformation. However, if a matrix
has repeated eigenvalues, it is not similar to a diagonal matrix unless it has a full (independent) set of
eigenvectors. If the eigenvectors are not independent then the original matrix is said to be defective. Even
if a matrix is defective, the solution from eig satisfies A*X = X*D.
Examples
The matrix
B = [ 3
-2
-2
4
-eps/4 eps/2
-.5
-.5
-.9
1
-1
.1
2*eps
-eps
0
1
];
has elements on the order of roundoff error. It is an example for which the nobalance option is necessary
to compute the eigenvectors correctly. Try the statements
[VB,DB] = eig(B)
B*VB - VB*DB
[VN,DN] = eig(B,'nobalance')
B*VN - VN*DN
Algorithm
MATLAB uses LAPACK routines to compute eigenvalues and eigenvectors:
Case
Routine
26-10-2015 12:59
3 of 4
Real symmetric A
http://nf.nci.org.au/facilities/software/Matlab/techdoc/ref/eig.html
DSYEV
Real nonsymmetric A:
With preliminary balance step
DGEEV
d = eig(A,'nobalance')
DGEHRD, DHSEQR
[V,D] = eig(A,'nobalance')
Hermitian A
ZHEEV
Non-Hermitian A:
With preliminary balance step
ZGEEV
d = eig(A,'nobalance')
ZGEHRD, ZHSEQR
[V,D] = eig(A,'nobalance')
Real symmetric A,
symmetric positive definite B.
Special case:
for real A, B
(same as real nonsymmetric A, real
general B)
eig(A,B,'qz')
DSYGV
DGGEV
DGGEV
Complex Hermitian A,
Hermitian positive definite B.
ZHEGV
Special case:
for complex A or B
(same as complex non-Hermitian A,
complex B)
eig(A,B,'qz')
ZGGEV
See Also
balance, condeig, eigs, hess, qz, schur
References
[1] Anderson, E., Z. Bai, C. Bischof, S. Blackford, J. Demmel, J. Dongarra, J. Du Croz, A. Greenbaum,
S. Hammarling, A. McKenney, and D. Sorensen, LAPACK User's Guide (http://www.netlib.org
/lapack/lug/ lapack_lug.html), Third Edition, SIAM, Philadelphia, 1999.
edit
eigs
26-10-2015 12:59
4 of 4
http://nf.nci.org.au/facilities/software/Matlab/techdoc/ref/eig.html
26-10-2015 12:59