Matlab - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Mathematics : Numerical Computations : Matlab : Matlab/qr

Matlab

  

qr

  

compute the QR orthogonal-triangular decomposition of a MapleMatrix or MatlabMatrix in MATLAB(R), where X*P = Q*R

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

qr(X, output=R)

qr(X, output=QR)

qr(X, output=QRP)

Parameters

X

-

MapleMatrix or MatlabMatrix

output

-

specify the form of the output (optional)

R

-

return the upper triangular matrix R

QR

-

return unitary matrix Q and upper triangular R matrix

QRP

-

return Q, R, and permutation matrix P

Description

• 

The qr command computes the QR orthogonal-triangular decomposition of a matrix (either a Maple matrix or a MatlabMatrix) in MATLAB®. When output=QRP, the result is computed where XP=QR. When output=QR, the result is computed where X=QR.

• 

The matrix X can be either square or rectangular.

• 

The matrix X is expressed as product of an upper triangular matrix and either a real orthonormal matrix or a complex unitary matrix.

• 

The default if no output option is specified is to return the matrices Q and R.

Examples

Define the Maple matrix

withMatlab:

maplematrix_aMatrix3,1,3,1,6,4,6,7,8,3,3,7

maplematrix_a:=313164678337

(1)

The QR decomposition of this MapleMatrix is computed and returns Q and R, as follows:

Q,RMatlab[qr]maplematrix_a

Q, R :=

[-0.404519917477945468 , 0.418121005003545431 ,  -0.120768607347027060 , -0.804334137667873206]

[-0.134839972492648424 , -0.903141370807658106 , 0.0315048540905287777 , -0.406400406400609482]

[-0.809039834955890602 , -0.0836242010007090253 , -0.399061485146697980 , 0.423333756667301608]

[-0.404519917477945301 , 0.0501745206004254873 , 0.908389959610246600 ,  0.0931334264668064182]

[-7.41619848709566209    -8.09039834955890668    -11.0568777443971715]

[                                                                    ]

[         0.             -5.43557306504609006    -2.67597443202269013]

[                                                                    ]

[         0.                      0.             2.92995143041917760 ]

[                                                                    ]

[         0.                      0.                      0.         ]

The QR decomposition returning only the R matrix is as follows:

MMatlab[qr]maplematrix_a,output='R'

[-7.41619848709566209 ,  -8.09039834955890668 ,  -11.0568777443971715]

[                                                                    ]

[0.0960043149368622339 ,  -5.43557306504609006 , -2.67597443202269013]

[                                                                    ]

[0.576025889621173404 ,   0.166971439413840017 ,  2.92995143041917760]

[                                                                    ]

[0.288012944810586701 , 0.0361500352119390120 , -0.704436674263540508]

To force the lower triangle entries to zero, use

MatrixM,shape=triangularupper

[-7.41619848709566209    -8.09039834955890668    -11.0568777443971715]

[                                                                    ]

[         0.             -5.43557306504609006    -2.67597443202269013]

[                                                                    ]

[         0.                      0.             2.92995143041917760 ]

[                                                                    ]

[         0.                      0.                      0.         ]

Note that the R in output='R' is surrounded by quotation marks, since the variable R was assigned previously.  QR decomposition returning Q, R, and P matrices is as follows:

Q,R,PMatlab[qr]maplematrix_a,output=QRP

See Also

LinearAlgebra[QRDecomposition]

Matlab

Matlab[chol]

Matlab[det]

Matlab[evalM]

Matlab[inv]

Matlab[lu]

MatlabMatrix

 


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam