% Adjust a gaussian
% Define the gaussian function
gausFun = @(hms,x) hms(1) .* exp (-(x-hms(2)).^2 ./ (2*hms(3)^2)) ;
init=[100;0;20]; % Hmax, mean, sigma
[P, FY, CVG, OUTP] = nonlin_curvefit (gausFun , init', XX, NN);
%Print estimated sigma
sigma_est=P(3)