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

Define a matrix and find the rank.

Since `A`

is a square matrix of full rank,
the orthonormal basis calculated by `orth(A)`

matches
the matrix `U`

calculated in the singular value decomposition, ```
[U,S]
= svd(A,'econ')
```

. This is because the singular values of `A`

are
all nonzero.

Calculate the orthonormal basis for the range of `A`

using `orth`

.

Q =
-0.1200 -0.8097 0.5744
0.9018 0.1531 0.4042
-0.4153 0.5665 0.7118

The number of columns in `Q`

is equal to `rank(A)`

.
Since `A`

is of full rank, `Q`

and `A`

are
the same size.

Verify that the basis, `Q`

, is orthogonal
and normalized within a reasonable error range.

The error is on the order of `eps`

.

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

Define a singular matrix and find the rank.

Since `A`

is rank deficient, the orthonormal
basis calculated by `orth(A)`

matches only the first ```
r
= 2
```

columns of matrix `U`

calculated in
the singular value decomposition, `[U,S] = svd(A,'econ')`

.
This is because the singular values of `A`

are *not* all
nonzero.

Calculate the orthonormal basis for the range of `A`

using `orth`

.

Q =
-0.7071 0
0 1.0000
-0.7071 0

Since `A`

is rank deficient, `Q`

contains
one fewer column than `A`

.