A better way, from both an execution time and numerical accuracy standpoint, is to use the matrix division operator x = A\b. One way to solve this is with x = inv(A)* b. A frequent misuse of inv arises when solving the system of linear equation sĪx = b. In practice, it is seldom necessary to form the explicit inverse of a matrix. A warning message is printed if X is badly scaled or nearly singular. Returns the inverse of the square matrix X. Inv (MATLAB Function Reference) MATLAB Function Reference