function gaussfit

Fit a one-dimensional gaussian to a vector. The gauss function is defined as G(x) = A + B*exp(-4ln2*(x-x0)^2/fwhm^2).

Syntax
result = gaussfit(X, Y, errors, estimate [, chisq])

Arguments
X:   A vector containing the x values to be fit
Y:   A vector containing the y values to be fit
errors:   The errors in Y
estimate:   Initial estimate for the fit of the form [A, B, x0, fwhm]
chisq:   If set to a named variable, the variable is overwritten with the chi-squared of the fit.


Returns
The returned vector contains the best-fit parameters in the form [A, B, x0, fwhm, d_A, d_B, d_x0, d_fwhm]

See also
function evalgaussfit