% OBJECTIVE FUNCTION
f = @(x,b) b(1)+b(2).*cos(2*pi*x/12)+b(3).*sin(2*pi*x/12) +  ...
      b(5).*cos(2*pi*x./b(4))+b(6).*sin(2*pi*x./b(4))+ b(8).*cos(2*pi*x./b(7)) +  ...
      b(9).*sin(2*pi*x./b(7))

% PROBLEM SETUP
NIST_ENSO

% 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 
% info.animfreq = 2	% frame frequency 
% optimview('lsqcurvefit',info) 