Gauss-Hermite Quadrature (Matlab)

This MATLAB function returns the abscissae and weights for Gauss-Hermite quadrature, given the number of abscissae you wish to have. This corresponds to the degree of the Hermite polynomial you are using. The algorithm is directly from Numerical Recipes. The documentation for the function is reproduced below:

Find the Gauss-Hermite abscissae and weights.

 N - The number of abscissae and weights to return.

Return Values:
 X - A column vector containing the abscissae.
 W - A column vector containing the corresponding weights.

Gauss-Hermite quadrature approximates definite integrals of the form

    \int^{-\infty}_{\infty} dx W(x) f(x)


    W(x) = \exp( - x^2 )

with the sum

    \sum_{n=1}^{N} w_{n} f(x_{n}).

This function returns the set of abscissae and weights

    {x_{n}, w_{n}}^{N}_{n=1}

for performing this calculation given N, the number of abscissae.
These abscissae correspond to the zeros of the Nth Hermite
polynomial.  It can be shown that such integration is exact when f(x)
is a polynomial of maximum order 2N-1.

The procedure in this calculation is taken more or less directly from

@BOOK{ press-etal-1992a,
    AUTHOR   = { Press, William  H.   and
                 Flannery, Brian  P.  and
                 Teukolsky, Saul  A.  and
                 Vetterling, William  T. },
    ISBN      = {0521431085},
    MONTH     = {October},
    PUBLISHER = {{Cambridge University Press}},
    TITLE     = {Numerical Recipes in C : The Art of Scientific Computing},
    YEAR      = {1992}