## RANK Calculate the Rank of a Matrix

Section: Array Generation and Manipulations

### Usage

Returns the rank of a matrix. There are two ways to use the`rank`

function is
y = rank(A,tol)

where `tol`

is the tolerance to use when computing the
rank. The second form is

y = rank(A)

in which case the tolerance `tol`

is chosen as

tol = max(size(A))*max(s)*eps,

where `s`

is the vector of singular values of `A`

. The
rank is computed using the singular value decomposition `svd`

.

### Examples

Some examples of matrix rank calculations--> rank([1,3,2;4,5,6]) ans = 2 --> rank([1,2,3;2,4,6]) ans = 1

Here we construct an ill-conditioned matrix, and show the use
of the `tol`

argument.

--> A = [1,0;0,eps/2] A = 1.0000 0 0 0.0000 --> rank(A) ans = 1 --> rank(A,eps/8) ans = 2