Run
Run
The objective function is smooth (twice continuously differentiable). Solve the optimization
problem using the Optimization Toolbox fmincon solver. fmincon finds a constrained minimum
of a function of several variables. This function has a unique minimum at the point x* = [-5,-
5] where it has a value f(x*) = -250.
Set options to return iterative display.
Get
options = optimoptions(@fmincon,'Algorithm','interior-point','Display','iter');
[Xop,Fop] = fmincon(Objfcn,X0,[],[],[],[],LB,UB,[],options)
First-order Norm of
Iter F-count f(x) Feasibility optimality step
0 3 -1.062500e+01 0.000e+00 2.004e+01
1 6 -1.578420e+02 0.000e+00 5.478e+01 6.734e+00
2 9 -2.491310e+02 0.000e+00 6.672e+01 1.236e+00
3 12 -2.497554e+02 0.000e+00 2.397e-01 6.310e-03
4 15 -2.499986e+02 0.000e+00 5.065e-02 8.016e-03
5 18 -2.499996e+02 0.000e+00 9.708e-05 3.367e-05
6 21 -2.500000e+02 0.000e+00 1.513e-04 6.867e-06
7 24 -2.500000e+02 0.000e+00 1.161e-06 6.920e-08
-5.0000 -5.0000
Fop =
-250.0000
Get
figure(fig);
hold on;