% OBJECTIVE FUNCTION
f = @(x,b) b(1)*x.^b(2)

% PROBLEM SETUP

dim = 2 % dimension of the minimization problem
nb = 6 % number of points

% NIST certified values
target = zeros(dim,1)
target(1) = 7.6886226176E-01
target(2) = 3.8604055871E+00

% start 1
ig1 = [1;5]
% start 2
ig2 = [0.7;4]

% points to fit
x = zeros(nb,1);
y = zeros(nb,1);
x(1)=1.309;	y(1)=2.138
x(2)=1.471;	y(2)=3.421
x(3)=1.49;	y(3)=3.597
x(4)=1.565;	y(4)=4.34
x(5)=1.611;	y(5)=4.882
x(6)=1.68;	y(6)=5.66

% 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) 