Solve the 1D “black box” problem by Golden section search (at least 3
iterations);
2. Plot the 1D and 2D “black box” functions;
3. Search the minimum of the 1D and 2D “black box” functions using
fmincon; try different starting points, and report your observation.
4. Search the minimum of the 1D and 2D functions using Generic
algorithm.
5. Compare the optimal solutions found by different methods.
here are the functions:
First:
function y = fun_1D(x)
% x: [0, 5]
y = (x-3).^2 - x.^3/100;
Second:
function y = Himmelblau_fun2d(x)
% x1, x2: [-5, 5]
% [x1,x2] = meshgrid(-5:0.1:5,-5:0.1:5);
x1 = x(1);
x2 = x(2);
y = ( x1.^2 + x2 - 11 ).^2 + ( x1 + x2.^2 - 7 ).^2;
Get Free Quote!
262 Experts Online