% OBJECTIVE FUNCTION
f = @(x,b) b(1)*exp(-b(2).*x)+b(3)*exp(-(x-b(4)).^2./b(5).^2)+ ...
b(6)*exp(-(x-b(7)).^2./b(8).^2)

% PROBLEM SETUP
NIST_Gauss3

% GRAPHIC REPRESENTATION
scatter(x,y)

% OPTIMIZATION 
rng(0)	% for tractability 
[b,info] = lsqcurvefit(f,ig1,x,y)	% running minimization 

% ANIMATION
% Uncomment the following code to generate animation % 
% rng(0)
% [~,info] = lsqcurvefit(f,ig1,x,y)
% info.plot = 'fit'
% info.animate = true	% plot animation 
% optimview('lsqcurvefit',info) 