When fitting a single Gaussian to data, one can take a log and fit a parabola. In matlab, this can be carried out as in the following example:
x = -1:0.1:1; sigma = 0.01; y = exp(-x.*x) + sigma*randn(size(x)); % test data: [p,s] = polyfit(x,log(y),2); % fit parabola to log yh = exp(polyval(p,x)); % data model norm(y-yh) % ans = 1.9230e-16 when sigma=0 plot(abs([y',yh']));In practice, it is good to avoid zeros in the data. For example, one can fit only to the middle third or so of a measured peak, restricting consideration to measured samples that are positive and ``look Gaussian'' to a reasonable extent. An improved estimate can be obtained using weighted least squares for the fit: Assuming the noise is uncorrelated at each point, the optimal weighting for each squared error can be shown to be the inverse of the variance of the noise at that point (search for ``generalized least squares''). The weighting y has been found to work well in practice [#!Wang2018!#].