To calculate the QR decomposition of a matrix in Matlab, you can use the qr() function. The function takes a single input argument, the matrix to be decomposed, and returns two matrices, Q and R, such that A = QR.
main.m153 chars12 lines
This will output:
main.m199 chars9 lines
In the above example, Q and R are the decomposition of the input matrix A. The Q matrix is an orthogonal matrix, and the R matrix is an upper triangular matrix.
gistlibby LogSnag