rankMatrix Rank
rank(A)A not containing Inf nor NaN.A larger than the default tolerance: max(size(A)) * eps(norm(A, 2))
0 if A is empty.rank(A, tol)A is the same as specified above for rank(A).tol is an array containing tolerances, which must be real non-negative numbers.tol.A larger than the corresponding tolerance in tol.tol is inf or nan, the corresponding number in the output array is zero.A is empty, it returns an array of all zeros, regardless of the tolerances.A below has rank 2.A = [1 0 0 0;0 1 0 0;0 1 0 0];
rank(A)
ans =
2.000
tol = max(size(A))*eps(norm(A, 2)), rank(A) and rank(A,tol) give the same results.A = [1 2 3 4;1 2 3 4;0 1 0 0]
r1 = rank(A)
tol = max(size(A))*eps(norm(A, 2))
r2 = rank(A,tol)
A =
1.000 2.000 3.000 4.000
1.000 2.000 3.000 4.000
0.000 1.000 0.000 0.000
r1 =
2.000
tol = 1e-15 ×
3.553
r2 =
2.000