12.07.2015 Views

What Is Optimization Toolbox?

What Is Optimization Toolbox?

What Is Optimization Toolbox?

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

fminconIftheHessianmatrixcanalsobecomputedand the Hessian option is 'on',i.e., options = optimset('Hessian','on'), then the function fun mustreturn the Hessian value H, a symmetric matrix, at x in a third outputargument. Note that by checking the value of nargout you can avoidcomputing H when fun is called with only one or two output arguments (inthe case where the optimization algorithm only needs the values of f andg 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 thepoint x. Thatis,the(i,j)th component of H is the second partial derivativeof f with respect to x iand x j,a symmetric matrix.. The Hessian is by definitionnonlcon The function that computes the nonlinear inequality constraints c(x)

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

Saved successfully!

Ooh no, something went wrong!