The rectangular filter is the simplest linear filter ; it is usually used as a smoother . The output of the rectangular filter at the time moment is the arithmetic mean of the input values corresponding to the moments of time close to :
- is the output of the filter at time moment ;
- is the input of the filter at time moment ;
- is the length of the “window” of the filter, indicating how many adjacent values are averaged to produce the output.
The rectangular filter is completely defined by a single parameter – the window size. The greater the parameter, the greater the degree of smoothing and, hence, the greater the suppression of the higher frequencies.
The term “rectangular” is used because the above expression, if represented as the weighted sum , is characterized by mutually equal weights . If the weights are plotted against , then the plot is a rectangle (of length and height ) .
Besides the one-dimensional variant of the rectangular filter described above, the rectangular filter may be defined for 2-dimensional data, e.g. for images. Such 2D-filters are used in image processing .