Open In App

Eigenvalues and Eigenvectors in MATLAB

Last Updated : 20 Nov, 2021
Improve
Improve
Like Article
Like
Save
Share
Report

Eigenvalues and Eigenvectors are properties of a square matrix.

Let  A =[a_{ij}]_{N*N}  is an N*N matrix, X be a vector of size N*1 and \lambda  be a scalar.

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

  • A matrix of size N*N possess N eigenvalues
  • Every eigenvalue corresponds to an eigenvector.

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

  • e = eig(A)
  • [V,D] = eig(A)
  • [V,D,W] = eig(A)
  • e = eig(A,B)

Let us discuss the above syntaxes in detail:

e = eig(A)

  • It returns the vector of eigenvalues of square matrix A.

Matlab

% 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)

  • It returns the diagonal matrix D having diagonals as eigenvalues.
  • It also returns the matrix of right vectors as V.
  • Normal eigenvectors are termed as right eigenvectors.
  • V is a collection of N eigenvectors of each N*1 size(A is N*N size) that satisfies A*V = V*D

Matlab

% 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)

  • Along with the diagonal matrix of eigenvalues D and right eigenvectors V, it also returns the left eigenvectors of matrix A.
  • A left eigenvector u is a 1*N matrix that satisfies the equation u*A = k*u, where k is a left eigenvalue of matrix A.
  • W is the collection of N left eigenvectors of A that satisfies W’*A = D*W’.

Matlab

% 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)

  • It returns the generalized eigenvalues of two square matrices A and B of the same size.
  • A generalized eigenvalue λ and a corresponding eigenvector v satisfy Av=λBv.

Matlab

% 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 :



Similar Reads

Applications of Eigenvalues and Eigenvectors
Eigenvalue: The specific set of scalars connected with the system of linear equations is known as eigenvalues. Matrix equations are where it's most commonly employed. The German term 'Eigen' denotes 'appropriate' or 'characteristic.' As a result, eigenvalue can also be referred to as a characteristic value, a characteristic root, appropriate values
3 min read
Difference Between MATLAB and Scilab
Performing computation with the help of programming languages was always been a focus for all mathematicians and statistician. Whereas to perform it efficiently it also depends on the scope of the problem. We have a variety of tools and languages to analyze and compute data. So let us discuss the most commonly used languages. 1. MATLAB : MATLAB is
2 min read
Display the red, green and blue color planes of a color image in MATLAB
Prerequisite - RGB image representation A colored image can be represented as a 3 order matrix. The first order is for the rows, the second order is for the columns and the third order is for specifying the color of the corresponding pixel. Here we use the RGB color format, so the third order will take 3 values of Red, Green ans Blue respectively.
2 min read
Classes and Object in MATLAB
A class is a blueprint that defines the variables and the methods which provide a commonly shared basis for its corresponding objects. It defines an object that encapsulates data and the operations performed on that data. classdef is a keyword used to define MATLAB classes. Syntax to define a class: classdef (Attributes) ClassName < SuperclassNa
4 min read
Differences Between MATLAB and R Programming Language
MATLAB: MATLAB stands for Matrix Laboratory. MATLAB is a high performance language, initially intended to provide access to the matrix software designed by the projects LINPACK (Linear System Package) and EISPACK (Eigen System Package). It incorporates the environment for computation, visualization and programming. MATLAB provides a modern language
4 min read
Difference Between MATLAB and Octave
1. MATLAB : MATLAB is a multi-paradigm numerical computing environment and a high-performance language that is used for technical computing. The name MATLAB stands for matrix laboratory. It was developed by Cleve Moler of the company MathWorks.Inc in the year 1984. It is written in C, C++, Java. It allows matrix manipulations, plotting of functions
2 min read
Arithmetic Encoding and Decoding Using MATLAB
Arithmetic coding is a type of entropy encoding utilized in lossless data compression. Ordinarily, a string of characters, for example, the words "hey" is represented for utilizing a fixed number of bits per character. In the most straightforward case, the probability of every symbol occurring is equivalent. For instance, think about a set of three
6 min read
Single Side Band (SSB) Modulation and Demodulation using MATLAB
Single sideband (SSB) modulation might be a sort of modulation used to send data, which includes an audio signal. Amplitude modulation produces an output signal in which the bandwidth is two times the most frequency of the original baseband signal. SSB modulation neglects this bandwidth increase, and also the power wasted on a carrier, at the price
2 min read
Difference Between MATLAB and Julia
MATLAB: MATLAB is a language that is globally used for performing the high-level technical computation. The term MATLAB is used for Matrix Laboratory, which facilitates us with an interactive environment to perform reports and data analysis. It also allows us to implement computing algorithms, plotting graphs, and other matrix functions. Some featu
2 min read
Difference Between MATLAB and Mathematica
Performing computation with the support of programming languages was always been a focus for all mathematicians and statisticians, whereas to perform it efficiently it heavily depends on the scope of the problem. We have a large variety of tools and languages to analyze and compute data. So let us discuss the most widely used languages. MATLAB: It
3 min read
Article Tags :
Practice Tags :