Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

numerical hessian

160 views
Skip to first unread message

Manthos Vogiatzoglou

unread,
Jan 26, 2010, 12:36:04 PM1/26/10
to
Dear all

I work with MATLAB R2008b. I am interested in calculating the central numerical (finite differences) hessian for a given function. In MATLAB's optimization toolbox help, says that MATLAB calculates numerical hessians however it does not say if there is a function that does exactly that.

Does anyboby know the name of this function, if it exists, or any place where I can download such a function?

Thanks in advance

John D'Errico

unread,
Jan 26, 2010, 1:18:03 PM1/26/10
to
"Manthos Vogiatzoglou" <vog...@gmail.com> wrote in message <hjn964$h0r$1...@fred.mathworks.com>...

Find derivest and its cousin, hessian, on the file
exchange. It does exactly what you ask for.

http://www.mathworks.com/matlabcentral/fileexchange/13490

fun = @(xy) exp(-sum(xy.^2));
hessian(fun, [0,0])

ans =
-2 0
0 -2

John

Manthos Vogiatzoglou

unread,
Jan 27, 2010, 7:30:21 AM1/27/10
to
Dear John thanks for the prompt reply.

My function is a likelihood function, therefore I have to pass to the function the data points as well. Can this be done with DERIVEST?

Manthos

John D'Errico

unread,
Jan 27, 2010, 8:45:22 AM1/27/10
to
"Manthos Vogiatzoglou" <vog...@gmail.com> wrote in message <hjpbkt$8ti$1...@fred.mathworks.com>...

> Dear John thanks for the prompt reply.
>
> My function is a likelihood function, therefore I have to pass to the function the data points as well. Can this be done with DERIVEST?
>
> Manthos

Sure. A function handle does this with no problem.
Your call might look vaguely like this...

H = hessian(@(x) likfun(x,datapoints,otherstuff),x0);

As long as the variables datapoints and otherstuff are
defined in the workspace, matlab will pass in their
values to the code. However the hessian code sees
this anonymous function handle as purely a function
of the variable x only.

John

0 new messages