You can use the \(\text{QR}\) function to perform a QR decomposition of a real or complex matrix, creating the \(Q\) unitary matrix and the \(R\) upper triangular matrix.

You can use the \qr backslash command to insert this function.

The following variants of this function are available:

  • \(\text{tuple } \text{QR} \left ( \text{<matrix>} \right )\)

The \(\text{<matrix>}\) is a real or complex matrix. Boolean and integer matrices are automatically upcast to real matrices.

The function returns a tuple containing:

  • The \(Q\) unitary matrix.

  • The \(R\) upper triagular matrix.

  • A boolean flag indicating success (true) or (false).

Figure 187 shows the basic use of the \(\text{QR}\) function.


Figure 187 Example Use Of The QR Function