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.

Examples That Use Standard Algorithms8 9 37.0713 2.44141 6.27 2.449 10 37.0713 2.44141 6.27 2.4410 11 26.2485 0.610352 1.52 0.6111 12 20.6649 1.52588 4.63 1.5312 13 17.2558 1.52588 6.97 1.5313 14 8.48582 1.52588 4.69 1.5314 15 4.08398 1.52588 3.77 1.5315 16 1.77589 1.52588 3.56 1.5316 17 0.692381 1.52588 3.31 1.5317 18 0.109777 1.16206 1.66 1.5318 19 0 0.0468565 0 1.53<strong>Optimization</strong> terminated successfully:First-order optimality is less than options.TolFunNonlinear Equations with Finite-Difference JacobianIn the preceding example, the function bananaobj evaluates F and computesthe Jacobian J. <strong>What</strong> if the code to compute the Jacobian is not available?By default, if you do not indicate that the Jacobian can be computed in theobjective function (by setting the Jacobian option in options to 'on'),fsolve, lsqnonlin, andlsqcurvefit instead use finite differencing toapproximate the Jacobian. This is the default Jacobian option. You can selectfinite differencing by setting Jacobian to 'off' using optimset.This example uses bananaobj from the preceding example as the objectivefunction, but sets Jacobian to 'off' so that fsolve approximates theJacobian and ignores the second bananaobj output. It accepts the fsolvedefault 'off' for the LargeScale option, and the default nonlinear equationmedium-scale algorithm 'dogleg':n = 64;x0(1:n,1) = -1.9;x0(2:2:n,1) = 2;options=optimset('Display','iter','Jacobian','off');[x,F,exitflag,output,JAC] = fsolve(@bananaobj,x0,options);2-25

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

Saved successfully!

Ooh no, something went wrong!