QR decomposition of a matrix. The matrix is decomposed as Q∙R. |
||
Syntax |
Q,R = QR(M) |
|
Argument |
Name |
Description |
M |
A matrix. |
|
Outputs |
Name |
Description |
Q |
The orthonormal matrix of the decomposition. |
|
R |
The upper triangle of the decomposition. Same size as M. |
|
Example |
Find the QR decomposition of a matrix. |
|
Syntax |
||
M = [1,2,-3;4,5,12;-7,8,14]; // Given matrix q,r = QR(M); |
||
Result |
||
q = -0.12309 -0.28949 -0.94923 -0.49237 -0.81267 0.31169 0.86164 -0.50574 0.042503 r = -8.124 4.1851 6.5238 0 -8.6882 -15.964 0 0 7.183 |
||
Comments |
QR decomposition is often used for used for solving over determined linear least squares equations Ax = b. |
|
See Also: |