Routines (alphabetical) > Routines: G > GAUSSIAN_FUNCTION

# GAUSSIAN_FUNCTION

The GAUSSIAN_FUNCTION function creates a Gaussian kernel used in convolution.

## Examples

; Create a 2-D Gaussian with a sigma of 1

gauss1 = GAUSSIAN_FUNCTION([1,1])

; Create a 2-D Gaussian with a sigma of 3, a width of 20,

; and a peak height of 5

gauss2 = GAUSSIAN_FUNCTION([3,3], WIDTH=20, MAXIMUM=5)

; Display the curves

s1 = SURFACE(gauss1, LAYOUT=[2,1,1], STYLE=1)

s2 = SURFACE(gauss2, LAYOUT=[2,1,2], STYLE=1, /CURRENT)

## Syntax

Result = GAUSSIAN_FUNCTION( Sigma [, /DOUBLE] [, MAXIMUM=value] [, /NORMALIZE] [, WIDTH=value] )

## Return Value

Returns the Gaussian array.

## Arguments

### Sigma

The sigma value used to calculate the Gaussian kernel. Sigma can either be a scalar or a vector of up to eight elements. The number of dimensions in the resulting kernel is equal to the number of elements in Sigma. Each element of Sigma is used to specify the sigma value for each dimension of the result. Unless the WIDTH keyword is set, the width of the kernel is determined by Sigma such that the kernel contains approximately three standard deviations in each dimension.

## Keywords

### DOUBLE

Set this keyword to force the computations to be done in double-precision arithmetic.

### MAXIMUM

Set this keyword to the maximum value of the resulting array. If neither MAXIMUM or NORMALIZE is set, the default maximum value is set to 1.0.

### NORMALIZE

If this keyword is set the peak height is calculated such that the Gaussian sum is 1.0. This keyword is ignored if MAXIMUM is set. If neither MAXIMUM nor NORMALIZE is set, the default maximum value will be set to 1.0.

### WIDTH

The width of the Gaussian array. This value can be used to override the value calculated from Sigma. WIDTH can be either a scalar or vector value. If WIDTH is a scalar, the same width is applied for every dimension. If WIDTH is a vector, each element of WIDTH is used to specify the width for each dimension in the Gaussian.

Note: The Gaussian is always symmetric. For even widths, the actual maximum of the array will be slightly less than the MAXIMUM value.

## Version History

8.1 | Introduced

## See Also

GAUSS_SMOOTH, CONVOL_FFT