rank

Computes the rank of matrix A.

Syntax

R = rank(A)

R = rank(A, tol)

Inputs

A
Any valid matrix.
Type: double | integer | logical
Dimension: matrix
tol
A real number used as the threshold for rounding off near zero singular values. The default is the largest dimension mulitiplied by eps, where s is the largest singular value.
Type: double | integer
Dimension: scalar

Outputs

R
The rank.

Examples

Matrix inputs without tolerance:
R = rank([3,2,6])
R = rank([3,2;6 5])
R = 1
R = 2
Matrix inputs with tolerance:
R = rank([3 2],4)
R = rank([3,2;6 5], 4)
R = 0
R = 1