VOOZH about

URL: https://www.geeksforgeeks.org/matlab/implementation-of-cayley-hamiltons-theorem-in-matlab/

⇱ Implementation of Cayley-Hamilton’s Theorem in MATLAB - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Implementation of Cayley-Hamilton’s Theorem in MATLAB

Last Updated : 31 May, 2024

According to linear algebra, every square matrix satisfies its own characteristic equation. Consider a square Matrix 'A' with order 'n', then its characteristic equation is given by the relationship

 where 'λ' is some real constant and 'I' is the identity matrix of order, the same as that of A's order.

Expanding the above Relation we get the: 

λn + C1λn-1 + C2λn-2 + . . . + CnIn = 0 (
Another form of Characteristic equation)
where C1, C2, . . . , Cn are Real Constants.

According to Cayley-Hamilton’s theorem, The above equation is satisfied by 'A', we have:

An + C1An-1 + C2An-2 + . . . + CnIn = 0 
constant

Different Methods that are used in the following code are:

  • input(text): This Method Displays the text written inside it and waits for the user to input a value and press the Return key.
  • size(A):  This method returns a row vector whose elements are the lengths of the corresponding dimensions of 'A'.
  • poly(A): This method returns the n+1 coefficients of the characteristic polynomial of the square matrix 'A'.
  • zeroes(size): This method returns an array of zeros with a size vector equal to that of 'size'.

Example:

Output:

👁 Image
Comment