Smooth (FPScript)

21.09.2021

Smoothes a data set by calculating a floating mean value.

Syntax

Smooth(DataSet, SmoothingWidth)

 

The syntax of the Smooth function consists of the following parts:

Part

Description

DataSet

The data set to be smoothed.

Permitted data structures are data series, data matrix, signal und signal series. All numeric data types are permitted.

If the argument is a list, then the function is executed for each element of the list and the result is also a list.

SmoothingWidth

Specifies how many neighboring values on the left and right of the value to be smoothed are to be included in the mean value. A value of 2, for instance, specifies that two neighbors are taken from both left and right. The mean value is thus formed from a total of five values.

Permitted data structures are scalar value. Supported data types are 16-bit integer und 32-bit integer.

The value must be greater or equal to 1.

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

Remarks

The data type of the result is always 64-bit floating point.

The structure of the result corresponds to that of the argument DataSet.

For each value in the data set, the arithmetic mean is formed with SmoothingWidth neighboring values on the left and right. When calculating the smoothing, there are insufficient left and right neighbors available for the first or last SmoothingWidth values in DataSet. These are then equated to the first or last value in DataSet. This means that the result contains the same number of values as the DataSet argument.

Smoothing corresponds to a convolution of the signal with a rectangular window of the width n = 2 * SmoothingWidth + 1. The following illustration shows the transfer function of the rectangular window for n = 10 and n = 20:

For complex data types the absolute value is formed.

Available in

FlexPro Basic, Professional, Developer Suite

Examples

Smooth({1., 4., 3., 5., 8., 7., 9.}, 1)

Results in {2, 2.66, 4., 5.33, 6.66, 8, 8.33}.

See Also

Mean Function

Signal Smoothing Analysis Object

Share article or send as email:

You might be interested in these articles