OKPEDIA MATLAB EN MATRICE

How to find the inverse matrix of a rectangular matrix in Matlab and Octave

To find the inverse matrix of a rectangular matrix on Matlab and Octave use the function pseudo-inverse pinv()

pinv(M)

The parameter M is a rectangular matrix.

The pinv() function calculates the inverse matrix of matrix M.

What is an inverse matrix? A matrix M is invertible and an inverse matrix M-1 exists if the product M*M-1 is an identity matrix.

Example

Define a rectangular matrix

>> M=[2 4 1;1 3 2]
M =
2 4 1
1 3 2

Calculate the inverse matrix of M using the function pinv()

>> pinv(M)
ans =
0.315789 -0.289474
0.210526 -0.026316
-0.473684 0.684211

Multiply the matrix M by the result of the pinv (M) function by rounding the product

>> round(M*pinv(M))
ans =
1 0
-0 1

If the result is an identity matrix, the pinv(M) matrix is the inverse matrix M-1 of the rectangular matrix M.

https://how.okpedia.org/en/matlab/how-to-find-the-inverse-matrix-of-a-rectangular-matrix-in-matlab-and-octave


Report an error or share a suggestion to enhance this page


Matrix in Matlab/Octave


FacebookTwitterLinkedinLinkedin