This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materials including this page, select Japan from the country navigator on the bottom of this page.


Rank of matrix


k = rank(A)
k = rank(A,tol)


The rank function provides an estimate of the number of linearly independent rows or columns of a full matrix.

k = rank(A) returns the number of singular values of A that are larger than the default tolerance, max(size(A))*eps(norm(A)).

k = rank(A,tol) returns the number of singular values of A that are larger than tol.


Use sprank to determine the structural rank of a sparse matrix.


There are a number of ways to compute the rank of a matrix. MATLAB® software uses the method based on the singular value decomposition, or SVD. The SVD algorithm is the most time consuming, but also the most reliable.

The rank algorithm is

s = svd(A);
tol = max(size(A))*eps(max(s));
r = sum(s > tol);

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

See Also

Introduced before R2006a

Was this topic helpful?