# GAUSSFIT

## Purpose:

Fits y(x) = A e-B(x-C)2 using linearization.

## Syntax:

GAUSSFIT(series)

(fit, coef) = GAUSSFIT(series)

(fit, A, B, C) = GAUSSFIT(series)

 series - Input series or array.

## Returns:

A series.

(fit, coef) = GAUSSFIT(series) returns both the fit and the coefficients as a series.

(fit, A, B, C) = GAUSSFIT(series) returns both the fit as a series and the coefficients as separate coefficients.

## Example:

W1: 10 * exp(-0.5 * ((-10..0.01..10) - 2)^2)

W2: gaussfit(w1);overp(w1, lred)

overplots the original data with the calculated Gaussian fit.

## Example:

(fit, coef) = gaussfit(w1)

fit is the same series as in W2,

coef == {10.0, 0.5, 2}

## Example:

(fit, A, B, C) = gaussfit(w1)

fit is the same series as in W2,

A == 10.0

B == 0.5

C == 2

## Remarks:

GAUSSFIT fits an exponential curve of the form:

The fit is accomplished by fitting a polynomial to the following equation:

The fitted Gaussian curve (fit, coef) = gaussfit(series) returns both the fit and the coefficients as a series where coef is in the form {A, B, C}.

If y is not positive, the result will be complex.