Open In App

Eigenvalues and Eigenvectors in MATLAB

Eigenvalues and Eigenvectors are properties of a square matrix.

Let is an N*N matrix, X be a vector of size N*1 and  be a scalar.



Then the values X,  satisfying the equation    are eigenvectors and eigenvalues of matrix A respectively.

Matlab allows the users to find eigenvalues and eigenvectors of matrix using eig() method. Different syntaxes of eig() method are:



Let us discuss the above syntaxes in detail:

e = eig(A)

% Square matrix of size 3*3
A = [0 1 2;
    1 0 -1;
    2 -1 0];
disp("Matrix");
disp(A);
  
% Eigenvalues of matrix A
e = eig(A);
disp("Eigenvalues");
disp(e);

                    

Output :

[V,D] = eig(A)

% Square matrix of size 3*3
A = [8 -6 2;
    -6 7 -4;
    2 -4 3];
disp("Matrix");
disp(A);
  
% Eigenvalues and right eigenvectors of matrix A
[V,D] = eig(A);
disp("Diagonal matrix of Eigenvalues");
disp(D);
disp("Right eigenvectors")
disp(V);

                    

Output :

[V,D,W] = eig(A)

% Square matrix of size 3*3
A = [10 -6 2;
    -6 7 -4;
     2 -4 3];
disp("Matrix :");
disp(A);
  
% Eigenvalues and right and left eigenvectors 
% of matrix A
[V,D,W] = eig(A);
disp("Diagonal matrix of Eigenvalues :");
disp(D);
disp("Right eigenvectors :")
disp(V);
disp("Left eigenvectors :")
disp(W);

                    

Output :

e = eig(A,B)

% Square matrix A and B of size 3*3
A = [10 -6 2;
    -6 7 -4;
     2 -4 3];
B = [8 6 1;
     6 17 2;
    -1 4 3];
      
disp("Matrix A:");
disp(A);
disp("Matrix B:");
disp(B);
  
% Generalized eigen values 
% of matrices A and B
e = eig(A,B);
disp("Generalized eigenvalues :")
disp(e);

                    

Output :


Article Tags :