Sphere

Problem definition

Objective function
f = @(x) x(:,1).^2 + x(:,2).^2
Optimization settings
o = struct	

% initializing struct

o.lb = -2

% lower bounds

o.ub = 2

% upper bounds

Graphic representation
[x,y] = meshgrid(o.lb:0.5:o.ub)
surf(x,y,f([x(:),y(:)]))

Problem properties

convexity smoothness minimum
1 f(0,0) = 0

Optimization example with fminsearch

Optimization
rng(0)	

% for tractability

x0 = [2,2]

% initial guess

[xmin,fmin,info] = fminsearch(f,x0,o)

% running minimization

Animation
rng(0)
x0 = [2,2]
[~,~,info] = fminsearch(f,x0,o)
info.sol = [0 0 0]	

% solution

info.animate = true

% plot animation

info.animfreq = 6

% frame frequency

optimview('fminsearch',info)

References

[1] M. A. Schumer, K. Steiglitz, "Adaptive Step Size Random Search", IEEE Transactions on Automatic Control. vol. 13, no. 3, pp. 270-276, 1968

Related functions

fminsearch | meshgrid | surf