Find inverse of matrix in MATLAB
Inverse function in MATLAB is used to find the inverse of a matrix. Suppose A is a matrix and B is the inverse of a then A*B will be an identity matrix. This function computes the inverse of a square matrix. This is used while solving linear equations. We can compute the inverse of a matrix by passing it to inv().
It takes a matrix as parameter.
It returns a matrix which is inverse of input matrix.
Below are some examples which depict how to compute the inverse of a matrix in MATLAB.
Example 1: This example takes a 3×3 matrix as input and computes its inverse using inv() function.
Example 2: Here is another example that takes a 2×2 matrix as input and computes its inverse.
Example 3: This example uses a singular matrix and tries to find its inverse. It will show a warning that the matrix is a singular matrix. Different versions of MATLAB gave a different value of inverse for singular matrix. This is due to the different versions of Math Kernel Library used in different versions of MATLAB.
warning: matrix singular to machine precision, rcond = 1.34572e-17