hessfun

Evaluates the value of the function 'fun', gradient, and hessian at a given point using forward differences.

You are now following this Submission

% hessfun('fun',x) evaluates the value of the function 'fun', gradient, and
% hessian at the point point x = [x1,..., xn]. This function uses forwards
% differences.
%
% Example:
%
% f = @(x) 10*cos(x(1))*sin(x(2)) + x(1)^2 - 2*x(2)^2 + 10;
% x0 = [pi/2; -pi];
% [f0,g0,h0] = hessfun(f, x0)
%
% Returns the values
% f0 =
% -7.2718
% g0 =
% 3.1416
% 12.5664
% h0 =
% 2.0037 10.0009
% 10.0009 -4.0039
%
% Contact info:
%
% Andres Tovar
% tovara@iupui.edu
% Indiana University-Purdue University Indianapolis

Cite As

Andres Tovar (2026). hessfun (https://in.mathworks.com/matlabcentral/fileexchange/69996-hessfun), MATLAB Central File Exchange. Retrieved .

General Information

MATLAB Release Compatibility

  • Compatible with any release

Platform Compatibility

  • Windows
  • macOS
  • Linux
Version Published Release Notes Action
1.0.1

Revised help

1.0.0