Skip to content

cond

Condition number of a matrix.

c = cond(A)
c = cond(A, p)

Returns the matrix condition number: cond(A) = norm(A, p) * norm(inv(A), p). For p = 2 (the default), this is the ratio of the largest to smallest singular value. Large condition numbers indicate A is close to singular and that solving A*x = b will lose numerical precision proportionally.

cond(eye(5)) % 1 (perfectly conditioned)
cond(magic(3)) % ~4.33
cond(hilb(5)) % ~4.77e+5 (Hilbert matrix is ill-conditioned)
  • rcond — Reciprocal condition number estimate (1-norm).
  • condest — 1-norm condition number estimate (sparse-friendly).
  • svd — Singular value decomposition.
  • norm — Vector or matrix norm.