Compute the 1-d Gaussian function and optionally the derivative
Compute the 1-D Gaussian function and optionally the derivative
at an array of points.
y = gaussian( xi, parms,[ pderiv ])
xi = array, independent variable of Gaussian function.
parms = parameters of Gaussian, 2, 3 or 4 element array:
parms = maximum value (factor) of Gaussian,
parms = mean value (center) of Gaussian,
parms = standard deviation (sigma) of Gaussian.
(if parms has only 2 elements then sigma taken from previous
call to gaussian(), which is stored in a common block).
parms = optional, constant offset added to Gaussian.
y - Function returns array of Gaussian evaluated at xi. Values will
be floating pt. (even if xi is double) unless the /DOUBLE keyword
/DOUBLE - set this keyword to return double precision for both
the function values and (optionally) the partial derivatives.
pderiv = [N,3] or [N,4] output array of partial derivatives,
computed only if parameter is present in call.
pderiv[*,i] = partial derivative at all xi absisca values
with respect to parms[i], i=0,1,2,.
Evaulate a Gaussian centered at x=0, with sigma=1, and a peak value
of 10 at the points 0.5 and 1.5. Also compute the derivative
IDL> f = gaussian( [0.5,1.5], [10,0,1], DERIV )
==> f= [8.825,3.25]. DERIV will be a 2 x 3 array containing the
numerical derivative at the two points with respect to the 3 parameters.
Written, Frank Varosi NASA/GSFC 1992.
Converted to IDL V5.0 W. Landsman September 1997
Use machar() for machine precision, added /DOUBLE keyword,
add optional constant 4th parameter W. Landsman November 2001