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.

Calling an Output Function Iterativelyendendswitch statecase 'init'hold oncase 'iter'% Concatenate current point and objective function% value with history. x must be a row vector.history.fval = [history.fval; optimValues.fval];history.x = [history.x; x];% Concatenate current search direction with% searchdir.searchdir = [searchdir;...optimValues.searchdirection'];plot(x(1),x(2),'o');% Label points with iteration number and add title.text(x(1)+.15,x(2),...num2str(optimValues.iteration));title('Sequence of Points Computed by fmincon');case 'done'hold offotherwiseendfunction f = objfun(x)f = exp(x(1))*(4*x(1)^2 + 2*x(2)^2 + 4*x(1)*x(2) +...2*x(2) + 1);endfunction [c, ceq] = confun(x)% Nonlinear inequality constraintsc = [1.5 + x(1)*x(2) - x(1) - x(2);-x(1)*x(2) - 10];% Nonlinear equality constraintsceq = [];end3 Save the file as runfmincon.m in a directory on the MATLAB path.2-91

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

Saved successfully!

Ooh no, something went wrong!