Skip to content

eig

Eigenvalues and eigenvectors.

e = eig(A)
[V, D] = eig(A)
[V, D] = eig(A, B) % generalized: A*V = B*V*D
[V, D] = eig(A, 'nobalance')

With one output, returns the eigenvalues of A as a column vector. With two outputs, returns matrix V of eigenvectors and diagonal matrix D of eigenvalues such that A*V = V*D.

When A is detected to be Hermitian (or symmetric for real input), uses the symmetric eigensolver — guaranteed real eigenvalues and orthogonal eigenvectors. Otherwise uses the general eigensolver.

The two-matrix form solves the generalized eigenvalue problem: A*V = B*V*D. Pass 'nobalance' as the second argument to skip the balancing step (sometimes useful for matrices with widely-varying entries where balancing introduces numerical noise).

A = [2 0; 0 3];
eig(A) % [2; 3]
[V, D] = eig(magic(3));
norm(magic(3)*V - V*D) % near-zero
  • svd — Singular value decomposition.
  • hess — Hessenberg form of a matrix.
  • schur — Schur decomposition.
  • null — Orthonormal basis for the null space of a matrix.