Generalized eigenvectors in MATLAB?
Asked Answered
T

1

6

Is there a way to obtain generalized eigenvectors in case of high multiplicity of eigenvalues with a single one or at least very few commands ? In case of multiplicity 1 for each eigenvalue I can use [V,D] = eig(A), but this command doesn't work for multiple eigenvalues.

Tow answered 1/10, 2012 at 11:29 Comment(0)
M
6

According to Matlab documentation, [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

Here an example how to do it yourself... First we enter a sample matrix A:

 A = [ 35  -12   4   30 ;
       22   -8   3   19 ;
      -10    3   0   -9 ;
      -27    9  -3  -23 ]; 

Then we explore its characteristic polynomial, eigenvalues, and eigenvectors.

 poly(A) 
 ans = 
     1.0000   -4.0000    6.0000   -4.0000    1.0000 

These are the coefficients of the characteristic polynomial, which hence is (λ − 1)^4 Then

 [V, D] = eigensys(A) 
 V = 
 [ 1, 0] 
 [ 0, 1] 
 [-1, 3] 
 [-1, 0] 


 D = 
 [1] 
 [1] 
 [1] 
 [1] 

Thus MATLAB finds only the two independent eigenvectors

 w1 = [1  0  -1  -1]';     
 w2 = [0  1   3   0]'; 

associated with the single multiplicity 4 eigenvalue λ=1 , which therefore has defect 2.
So we set up the 4x4 identity matrix and the matrix B=A-λI

  Id = eye(4);        
  B = A - L*Id; 

with L=1, When we calculate B^2 and B^3

  B2 = B*B      
  B3 = B2*B 

We find that B2 ≠ 0, but B3 = 0, so there should be a length 3 chain associated with
the eigenvalue λ = 1 . Choosing the first generalized eigenvector

 u1 = [1  0  0  0]'; 

we calculate the further generalized eigenvectors

 u2 = B*u1 
 u2 = 
     34 
     22 
    -10 
    -27 

and

 u3 = B*u2 
 u3 = 
     42 
      7 
    -21 
    -42 

Thus we have found the length 3 chain {u3, u2, u1} based on the (ordinary) eigenvector u3. (To reconcile this result with MATLAB's eigensys calculation, you can check that u3-42w1=7w2)

Monkhmer answered 1/10, 2012 at 14:29 Comment(2)
Absolutely brilliant answer. Thank you very much, this is exactly what I was looking for!Tow
In more recent versions of Matlab, eigensys does not exist anymore. eig(sym(A)) can be used as a substitute, though the outputs won't match exactly. Also, an alternative to poly is charpoly, which returns symbolic results.Decelerate

© 2022 - 2024 — McMap. All rights reserved.