hilb function matlab

The hilb function creates a matrix, the Hilbert matrix, which looks really nice and is easy to work with analytically, but computationally it is really nasty to work with because it is extremely ill-conditioned.
 
The smart part about the MATLAB HILB function is that it demonstrates the idea of ‘vectorization’. Here is hilb(4)

Example

>> Z = hilb(4)

Z =

    1.0000    0.5000    0.3333    0.2500
    0.5000    0.3333    0.2500    0.2000
    0.3333    0.2500    0.2000    0.1667
    0.2500    0.2000    0.1667    0.1429

The general formula is H(i , j) = 1 / ( i + j -1).