## SMOOTH

The SMOOTH function returns a copy of Array smoothed with a boxcar average of the specified width. The result has the same type and dimensions as Array . The algorithm used by SMOOTH is:

where N is the number of elements in A.

### Calling Sequence

Result = SMOOTH( Array, Width )

### Arguments

#### Array

The array to be smoothed. Array can have any number of dimensions.

#### Width

The width of the smoothing window, in each dimension. Width should be an odd number, smaller than the smallest dimension of Array . If Width is an even number, one plus the given value of Width is used. For example, if you use a Width of 3 to smooth a two-dimensional array, the smoothing window will contain nine elements (including the element being smoothed). The value of Width does not affect the running time of SMOOTH to a great extent.

### Keywords

#### EDGE_TRUNCATE

Set this keyword to apply the smoothing function to all points. If the neighborhood around a point includes a point outside the array, the nearest edge point is used to compute the smoothed result. If EDGE_TRUNCATE is not set, the end points are copied from the original array to the result with no smoothing.

For example, when smoothing an n -element vector with a three point wide smoothing window, the first point of the result R 0 is equal to A 0 if EDGE_TRUNCATE is not set, but is equal to (A 0 +A 0 +A 1 )/3 if the keyword is set. In the same manner, point R n-1 is set to A n-1 if EDGE_TRUNCATE is not set, or to (A n-2 +A n-1 +A n-1 )/3 if it is.

Points not within a distance of Width /2 from an edge are not affected by this keyword.

#### NAN

Set this keyword to cause the routine to check for occurrences of the IEEE floating-point value NaN in the input data. Elements with the value NaN are treated as missing data. (See Special Floating-Point Values for more information on IEEE floating-point values.)

### Example

Create and display a simple image by entering:

D = SIN(DIST(256)/3) & TVSCL, D

Now display the same dataset smoothed with a width of 9 by entering:

TVSCL, SMOOTH(D, 9), 256, 256