This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

eig

Eigenvalues and eigenvectors of symbolic matrix

Syntax

lambda = eig(A)
[V,D] = eig(A)
[V,D,P] = eig(A)
lambda = eig(vpa(A))
[V,D] = eig(vpa(A))

Description

example

lambda = eig(A) returns a symbolic vector containing the eigenvalues of the square symbolic matrix A.

example

[V,D] = eig(A) returns matrices V and D. The columns of V present eigenvectors of A. The diagonal matrix D contains eigenvalues. If the resulting V has the same size as A, the matrix A has a full set of linearly independent eigenvectors that satisfy A*V = V*D.

[V,D,P] = eig(A) returns a vector of indices P. The length of P equals to the total number of linearly independent eigenvectors, so that A*V = V*D(P,P).

example

lambda = eig(vpa(A)) returns numeric eigenvalues using variable-precision arithmetic.

[V,D] = eig(vpa(A)) also returns numeric eigenvectors.

Examples

collapse all

Compute eigenvalues for the magic square of order 5.

M = sym(magic(5));
eig(M)
ans =
                                65
  (625/2 - (5*3145^(1/2))/2)^(1/2)
  ((5*3145^(1/2))/2 + 625/2)^(1/2)
 -(625/2 - (5*3145^(1/2))/2)^(1/2)
 -((5*3145^(1/2))/2 + 625/2)^(1/2)

Compute numeric eigenvalues for the magic square of order 5 using variable-precision arithmetic.

M = magic(sym(5));
eig(vpa(M))
ans =
                                65.0
 21.27676547147379553062642669797423
 13.12628093070921880252564308594914
  -13.126280930709218802525643085949
  -21.276765471473795530626426697974

Compute the eigenvalues and eigenvectors for one of the MATLAB® test matrices.

A = sym(gallery(5))
A =
[   -9,    11,   -21,     63,   -252]
[   70,   -69,   141,   -421,   1684]
[ -575,   575, -1149,   3451, -13801]
[ 3891, -3891,  7782, -23345,  93365]
[ 1024, -1024,  2048,  -6144,  24572]
[v, lambda] = eig(A)
v =
       0
  21/256
 -71/128
 973/256
       1
 
lambda =
[ 0, 0, 0, 0, 0]
[ 0, 0, 0, 0, 0]
[ 0, 0, 0, 0, 0]
[ 0, 0, 0, 0, 0]
[ 0, 0, 0, 0, 0]

See Also

| | |

Introduced before R2006a