## Name

rgfit

## Purpose

Fit a radial gaussian function and 2nd order polynominal to the input data.

## Description

Fit the equation y=f(r) where:

F(r) = A0*EXP(-z^2/2) + A2 + A3*r + A4*r^2

and

z=r/A2

A0 = height of exp, A1 = sigma (the width).

A2 = constant term, A3 = linear term, A4 = quadratic term.

The parameters A0, A1, A2 are estimated and then CURVEFIT is

called. The gaussian is assumed to be centered at r=0.

## Category

Function fitting

## Calling Sequence

Result = GAUSSFIT(R, Y [, A])

## Inputs

R: The independent variable. R must be a vector.

Y: The dependent variable. Y must have the same number of points

as R.

## Outputs

The fitted function is returned.

## Optional Output Parameters

A: The coefficients of the fit. A is a five-element vector as

described under PURPOSE.

## Common Blocks

None.

## Side Effects

None.

## Restrictions

## Procedure

The initial guess of the intensity is the value of the point

with the smallest r value. The first point that drops below

half of the first is the guess at the width.

If the (MAX-AVG) of Y is larger than (AVG-MIN) then it is assumed

that the line is an emission line, otherwise it is assumed there

is an absorbtion line. The estimated center is the MAX or MIN

element. The height is (MAX-AVG) or (AVG-MIN) respectively.

The width is found by searching out from the extrema until

a point is found less than the 1/e value.

## Modification History

DMS, RSI, Dec, 1983.

Rewritten to change initial guess, MWB, Lowell Obs., Dec. 1992.

93/05/11, put in failsafe on gaussian width guess, MWB, Lowell Obs.