rank

Compute the rank of matrix A.

Syntax

R = rank(A)

R = rank(A, tol)

Inputs

A
The matrix whose rank is computed.
Dimension: matrix
tol
A scalar threshold for rounding off near zero singular values. The default is the largest dimension mulitiplied by eps(s), where s is the largest singular value.
Type: double
Dimension: scalar

Outputs

R
The rank.
Type: integer

Examples

Matrix input with default tolerance:
R = rank([1,2,3;4,5,6;7,8,9.1])
R = 3
Matrix input with specified tolerance:
R = rank([1,2,3;4,5,6;7,8,9.1], 0.02)
R = 2