hilb
Hilbert matrix, with entries 1/(i+j-1).
Category: Mathematics > Elementary Math
Syntax
H = hilb(n)
Returns the n-by-n Hilbert matrix.
Description
The Hilbert matrix is the classical example of an ill-conditioned matrix. Its condition number grows exponentially with n (about 1.6e13 already for n = 10), so solving H*x = b in floating point loses most digits for modest sizes. It comes from least-squares fitting by polynomials on the interval from 0 to 1.
Its exact inverse has integer entries and is returned by invhilb.
Input arguments
n- Nonnegative integer, the order of the matrix.
Output arguments
H- Symmetric positive definite matrix with
H(i, j) = 1/(i + j - 1).
Example
A 3-by-3 Hilbert matrix
H = hilb(3)
cond(hilb(8))
Output
H = 3×3
1.0000 0.5000 0.3333
0.5000 0.3333 0.2500
0.3333 0.2500 0.2000
ans = 1.5258e+10