Note: This page has been translated by MathWorks. Click here to see

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Solve systems of linear equations *xA = B* for *x*

`x = B/A`

`x = mrdivide(B,A)`

solves
the system of linear equations `x`

= `B`

/`A`

`x*A = B`

for `x`

.
The matrices `A`

and `B`

must
contain the same number of columns. MATLAB^{®} displays a warning
message if `A`

is badly scaled or nearly singular,
but performs the calculation regardless.

If

`A`

is a scalar, then`B/A`

is equivalent to`B./A`

.If

`A`

is a square`n`

-by-`n`

matrix and`B`

is a matrix with`n`

columns, then`x = B/A`

is a solution to the equation`x*A = B`

, if it exists.If

`A`

is a rectangular`m`

-by-`n`

matrix with`m ~= n`

, and`B`

is a matrix with`n`

columns, then`x`

`=`

`B`

/`A`

returns a least-squares solution of the system of equations`x*A = B`

.

The operators

`/`

and`\`

are related to each other by the equation`B/A = (A'\B')'`

.If

`A`

is a square matrix, then`B/A`

is roughly equal to`B*inv(A)`

, but MATLAB processes`B/A`

differently and more robustly.

Was this topic helpful?