% OBJECTIVE FUNCTION
f = @(x) 100*sqrt(abs(x(:,2) - 0.01*x(:,1).^2)) + 0.01*(abs(x(:,1) + 10))

% OPTIMIZATION SETTINGS
o = struct	% initializing struct
o.lb = [-15 -3]	% lower bounds
o.ub = [-5 3]	% upper bounds

% GRAPHIC REPRESENTATION
[x,y] = meshgrid(-15:0.5:-5, -3:0.2:3)
surf(x,y,f([x(:),y(:)]))

% OPTIMIZATION 
rng(0)	% for tractability 
x0 = [-9.2,3]	% initial guess 
[xmin,fmin,info] = fminsearch(f,x0,o)	% running minimization  

% ANIMATION
% Uncomment the following code to generate animation % 
% rng(0)
% x0 = [-9.2,3]
% [~,~,info] = fminsearch(f,x0,o)
% info.sol = [-10 1 0]	% solution 
% info.animate = true	% plot animation 
% info.animfreq = 5	% frame frequency 
% info.np = [21 31]	% number of points for meshgrid 
% optimview('fminsearch',info)