Matlab-Matrix - Inverse


Advertisements

The inverse of a matrix A is denoted by A−1 such that the following relationship holds −

AA−1 = A−1A = 1

The inverse of a matrix does not always exist. If the determinant of the matrix is zero, then the inverse does not exist and the matrix is singular.

Inverse of a matrix in MATLAB is calculated using the inv function. Inverse of a matrix A is given by inv(A).

Example

Here is an example to calculate inverse of given matrix −

a = [ 1 2 3; 2 3 4; 1 2 5];
test = inv(a)

Output

The execution in MATLAB gives following result −

>> a = [ 1 2 3; 2 3 4; 1 2 5];
test = inv(a)

test =

   -3.5000   2.0000   0.5000
    3.0000  -1.0000  -1.0000
   -0.5000       0    0.5000
 
>>
Advertisements