Documentation

orth

Orthonormal basis for range of matrix

Syntax

Description

example

Q = orth(A)returns an orthonormal basis for therangeofA.The columns ofQare vectors, which span the range ofA.The number of columns inQis equal to therankofA

Examples

collapse all

Calculate and verify the orthonormal basis vectors for the range of a full rank matrix.

Define a matrix and find the rank.

A = [1 0 1;-1 -2 0; 0 1 -1]; r = rank(A)
r = 3

Ais a square matrix of full rank, the orthonormal basis calculated byorth(A)matches the matrixUcalculated in the singular value decomposition,[U,S] = svd(A,'econ').This is because the singular values ofAare all nonzero.

Calculate the orthonormal basis for the range ofAusingorth

Q = orth(A)
Q =3×3-0.1200 -0.8097 0.5744 0.9018 0.1531 0.4042 -0.4153 0.5665 0.7118

The number of columns inQis equal torank(A).自Ais of full rank,QandAare the same size.

Verify that the basis,Q, is orthogonal and normalized within a reasonable error range.

E = norm(eye(r)-Q'*Q,'fro')
E = 1.0857e-15

The error is on the order ofeps

Calculate and verify the orthonormal basis vectors for the range of a rank deficient matrix.

Define a singular matrix and find the rank.

A = [1 0 1; 0 1 0; 1 0 1]; r = rank(A)
r = 2

Ais rank deficient, the orthonormal basis calculated byorth(A)matches only the firstr = 2columns of matrixUcalculated in the singular value decomposition,[U,S] = svd(A,'econ').This is because the singular values ofAarenotall nonzero.

Calculate the orthonormal basis for the range ofAusingorth

Q = orth(A)
Q =3×2-0.7071 -0.0000 0 1.0000 -0.7071 0.0000

Ais rank deficient,Qcontains one fewer column thanA

Input Arguments

collapse all

Input matrix.

Data Types:single|double
Complex Number Support:Yes

More About

collapse all

Range

The column space, orrange, of a matrixAis the collection of all linear combinations of the columns ofA.任何向量,bthat is a solution to the linear equation,A * x =, is included in the range ofAsince you can also write it as a linear combination of the columns ofA

Rank

Therankof a matrix is equal to the dimension of the range.

Algorithms

orthis obtained fromUin the singular value decomposition,[U,S] = svd(A,'econ').Ifr = rank(A)the firstrcolumns ofUform an orthonormal basis for the range ofA

Extended Capabilities

See Also

||

Introduced before R2006a