ref is used to solve a linear system of equations written in matrix form:
The argument of ref is the augmented matrix of the system
(the matrix obtained by augmenting the matrix A to the right with
the column vector B).
The result is a matrix [A1,B1] where A1 has zeros
under its principal diagonal, and the solutions of:
are the same as the solutions of:
For example, solve the system :
⎧ ⎨ ⎩ |
|
Input :
Output :
Hence the solution is y=4 (last row) and x=−2 (substitute y in the first row).