12.07.2015 Views

What Is Optimization Toolbox?

What Is Optimization Toolbox?

What Is Optimization Toolbox?

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

fminuncThe gradient is the partial derivatives of f at the point x. Thatis,theithcomponent of g is the partial derivative of f with respect to the ith componentof x.IftheHessianmatrixcanalsobecomputedand the Hessian option is 'on', i.e.,options = optimset('Hessian','on'), then the function fun must return theHessian value H, a symmetric matrix, at x in a third output argument. Note thatby checking the value of nargout you can avoid computing H when fun is calledwith only one or two output arguments (in the case where the optimizationalgorithm only needs the values of f and g but not H).function [f,g,H] = myfun(x)f = ... % Compute the objective function value at xif nargout > 1 % fun called with two output argumentsg = ... % Gradient of the function evaluated at xif nargout > 2H = ... % Hessian evaluated at xendendThe Hessian matrix is the second partial derivatives matrix of f at the point x.That is, the (i,j)th component of H is the second partial derivative of f withrespect to x iand x j,. The Hessian is by definition a symmetric matrix.options “Options” on page 8-80 provides the function-specific details for the optionsvalues.OutputArguments“Function Arguments” on page 6-2 contains general descriptions ofarguments returned by fminunc. This section provides function-specificdetails for exitflag and output:8-78

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!