Rosenbrock

Problem definition

Objective function
f = @(x) 100*(x(:,2) - x(:,1).^2).^2 + (x(:,1) - 1).^2
Graphic representation
[x,y] = meshgrid(-2:0.5:2, -1:0.5:2.5)
surf(x,y,f([x(:),y(:)]))

Problem properties

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

Optimization example with fminsearch

Optimization
rng(0)	

% for tractability

x0 = [-1.2,1]

% initial guess

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

% running minimization

Animation
rng(0)
x0 = [-1.2,1]
[~,~,info] = fminsearch(f,x0)
info.sol = [1 1 0]	

% solution

info.animate = true

% plot animation

info.animfreq = 5

% frame frequency

optimview('fminsearch',info)

References

[1] H. H. Rosenbrock, "An Automatic Method for Finding the Greatest or Least Value of a Function", 1960

Related functions

fminsearch | meshgrid | surf