Smoothens a data set by calculating a floating mean value.
Syntax
Smooth(DataSet, SmoothingWidth [ , Padding = PADDING_NONE ])
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. For complex data types the absolute value is formed. 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 values are to be included in each mean value. If you enter an odd number, the same number of neighboring values to the left and right of the value to be smoothed are included in the mean value. If you enter an even number, one more neighboring value is included in the mean value to the right of the value to be smoothed than to the left. An odd smoothing width is therefore preferable in order to avoid a phase shift. Permitted data structures are Scalar value. Supported data types are 16-bit integer, 32-bit integer und 64-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. |
||||||||||
Padding |
Specifies whether and how the smoothing window should be filled at the edges of the data set. The argument Padding can have the following values:
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. If this argument is omitted, it will be set to the default value PADDING_NONE . |
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.
The result has the same number of values as the argument DataSet.
The mean value is calculated as follows:
Void values in DataSet are ignored during averaging, i.e. the number of values in the averaging window is reduced.
With Padding equal to PADDING_ZERO the smoothing corresponds to a convolution of the signal with a rectangular window of width SmoothingWidth. The following illustration shows the transfer function of the rectangular window for n = 10 and n = 20:
Available in
FlexPro Basic, Professional, Developer Suite
Examples
Smooth({1, 4, 3, 5, 8, 7, 9}, 3) |
Results in {2.5, 2.66, 4, 5.33, 6.66, 8, 8}. |
Smooth({1, 4, 3, 5, 8, 7, 9}, 3, PADDING_CONSTANT) |
Results in {2, 2.66, 4., 5.33, 6.66, 8, 8.33}. |
Smooth({1, 2, 3, 2, 1}, 3, PADDING_LINEAR) |
Results in {1, 2, 2.33, 2, 1}. |
Smooth({1, ?, 1}, 3, PADDING_NONE) |
Results in {1, 1, 1}. |