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 TutorialThe tutorial uses the functions fminunc, fmincon, andfsolve. The otheroptimization routines, fgoalattain, fminimax, lsqnonlin, andfseminf,are used in a nearly identical manner, with differences only in the problemformulation and the termination criteria. The section “MultiobjectiveExamples” on page 2-26 discusses multiobjective optimization and givesseveral examples using lsqnonlin, fminimax, andfgoalattain, includinghow Simulink can be used in conjunction with the toolbox.Unconstrained Minimization ExampleConsider the problem of finding a set of values [x 1, x 2]thatsolvesTo solve this two-dimensional problem, write an M-file that returns thefunction value. Then, invoke the unconstrained minimization routinefminunc.(2-1)Step1: WriteanM-fileobjfun.m.function f = objfun(x)f = exp(x(1))*(4*x(1)^2+2*x(2)^2+4*x(1)*x(2)+2*x(2)+1);Step 2: Invoke one of the unconstrained optimization routines.x0 = [-1,1]; % Starting guessoptions = optimset('LargeScale','off');[x,fval,exitflag,output] = fminunc(@objfun,x0,options)After 40 function evaluations, this produces the solutionx =0.5000 -1.0000The function at the solution x is returned in fval:fval =3.6609e-0152-10

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

Saved successfully!

Ooh no, something went wrong!