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.

fsolvefunThe nonlinear system of equations to solve. fun is a function that acceptsavectorx and returns a vector F, the nonlinear equations evaluated atx. The function fun can be specified as a function handle for an M-filefunctionx = fsolve(@myfun,x0)where myfun is a MATLAB function such asfunction F = myfun(x)F = ...% Compute function values at xfun can also be a function handle for an anonymous function.x = fsolve(@(x)sin(x.*x),x0);If the user-defined values for x and F are matrices, they are convertedto a vector using linear indexing.If the Jacobian can also be computed and the Jacobian option is 'on',set byoptions = optimset('Jacobian','on')then the function fun must return, in a second output argument, theJacobian value J, amatrix,atx. Note that by checking the value ofnargout, the function can avoid computing J when fun is called with onlyone output argument (in the case where the optimization algorithm onlyneeds the value of F but not J).function [F,J] = myfun(x)F = ...% objective function values at xif nargout > 1 % two output argumentsJ = ... % Jacobian of the function evaluated at xendoptionsIf fun returns a vector (matrix) of m components and x has length n, wheren is the length of x0, then the Jacobian J is an m-by-n matrix where J(i,j)is the partial derivative of F(i) with respect to x(j). (Note that theJacobian J is the transpose of the gradient of F.)“Options” on page 8-111 provides the function-specific details for theoptions values.8-109

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

Saved successfully!

Ooh no, something went wrong!