Products & Services Solutions Academia Support User Community Company

Learn more about Symbolic Math Toolbox   

eig - Compute symbolic eigenvalues and eigenvectors

Syntax

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

Description

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

[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).

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

[V,D] = eig(vpa(A)) returns numeric eigenvectors using variable precision arithmetic. If A does not have a full set of eigenvectors, the columns of V are not linearly independent.

Examples

Compute the eigenvalues for the magic square of order 5:

M = sym(magic(5));
eig(M)

The result is:

ans =
                               65
 (625/2 - (5*3145^(1/2))/2)^(1/2)
 ((5*3145^(1/2))/2 + 625/2)^(1/2)
  -(625/2 - 5/2*3145^(1/2))^(1/2)
  -(5/2*3145^(1/2) + 625/2)^(1/2)
 

Compute the eigenvalues for the magic square of order 5 using variable precision arithmetic:

M = sym(magic(5));
eig(vpa(M))

The result is:

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))
[v, lambda] = eig(A) 

The results are:

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 =
       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

jordan | poly | svd | vpa

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS