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.

2 Tutorialcomponents.');end% Evaluate the vector functionodds = 1:2:n;evens = 2:2:n;F = zeros(n,1);F(odds,1) = 1-x(odds);F(evens,1) = 10.*(x(evens)-x(odds).^2);% Evaluate the Jacobian matrix if nargout > 1if nargout > 1c = -ones(n/2,1); C = sparse(odds,odds,c,n,n);d = 10*ones(n/2,1); D = sparse(evens,evens,d,n,n);e = -20.*x(odds); E = sparse(evens,odds,e,n,n);J = C + D + E;endStep 2: Call the solve routine for the system of equations.n = 64;x0(1:n,1) = -1.9;x0(2:2:n,1) = 2;options=optimset('Display','iter','Jacobian','on');[x,F,exitflag,output,JAC] = fsolve(@bananaobj,x0,options);Use the starting point for the odd indices, and for theeven indices. Accept the fsolve default 'off' for the LargeScale option, andthe default medium-scale nonlinear equation algorithm 'dogleg'. ThensetJacobian to 'on' to use the Jacobian defined in bananaobj.m .Thefsolvefunction generates the following output:Norm of First-order Trust-regionIteration Func-count f(x) step optimality radius0 1 4281.92 615 11 2 1546.86 1 329 12 3 112.552 2.5 34.8 2.53 4 106.24 6.25 34.1 6.254 5 106.24 6.25 34.1 6.255 6 51.3854 1.5625 6.39 1.566 7 51.3854 3.90625 6.39 3.917 8 43.8722 0.976562 2.19 0.9772-24

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

Saved successfully!

Ooh no, something went wrong!