INV Invert Matrix

Section: Transforms/Decompositions

Usage

Inverts the argument matrix, provided it is square and invertible. The syntax for its use is
   y = inv(x)

Internally, the inv function uses the matrix divide operators. For sparse matrices, a sparse matrix solver is used.

Example

Here we invert some simple matrices
--> a = randi(zeros(3),5*ones(3))

a = 
 1 4 3 
 1 1 3 
 1 4 5 

--> b = inv(a)

b = 
    1.1667    1.3333   -1.5000 
    0.3333   -0.3333         0 
   -0.5000         0    0.5000 

--> a*b

ans = 
    1.0000         0         0 
    0.0000    1.0000         0 
         0         0    1.0000 

--> b*a

ans = 
    1.0000    0.0000         0 
         0    1.0000    0.0000 
         0         0    1.0000