Numeric differentiation

numgradient and numhessian can be used for numeric differentiation. numgradient returns the derivative of an $ n\times1$ vector-valued function with respect to a $ k\times1$ vector in a $ n\times k$ matrix. numhessian returns the derivative of a real-valued function with respect to a $ k\times1$ vector in a $ k\times k$ matrix. Both functions are quite accurate. numderivatives.m, which follows, shows how it can be done.

/home/sh/Dokumenter/octave/octave-forge/main/optim/doc/numderivatives.m

The results are:

/home/sh/Dokumenter/octave/octave-forge/main/optim/doc/numderivative.out



Søren Hauberg 2008-04-29