function multigaussfit

Fit multiple gaussians to a vector. The gauss function is defined as G(x) = SUM_i [A_i + B_i*exp(-4ln2*(x-x0_i)^2/fwhm_i^2)].

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

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.

The returned vector contains the best-fit parameters in the form [A1, B1, x01, fwhm1, A2, ..., d_A1, d_B1, d_x01, d_fwhm1, d_A2, ...]

See also
function gaussfit