Window functions find many uses in signal processing,
including spectral analysis and filter design.
Window functions are usually applied to a signal
before its Fourier transform is computed.
The WindowFunction
class represents window functions. The
WindowFunctions
class provides static methods that can be used to construct the most commonly used window functions.
Creating window functions
Window functions are created by calling a method
on the WindowFunctions.
All methods take the length of the window as the first parameter.
All window functions are normalized so the largest value is 1.
(For windows with an even number of samples, this value may not appear.)
Some methods have an overload that takes an additional parameter of type
WindowSampling.
Method | Description |
---|
Symmetric
| The window is symmetrical about its center point. |
Periodic
| The window can be applied to a signal with implicit periodicity. |
The following window functions are available:
Method | Description |
---|
Bartlett | A Bartlett window. |
Blackman | A Blackman window with an optional parameter (default value is 0.16>). |
BlackmanHarris | A Blackman-Harris window. |
Chebyshev | A Chebyshev window with the specified sidelobe attenuation in dB. |
Cosine | A cosine window. |
FlatTop | A flat top window. |
Gaussian | A Gaussian window with the specified standard deviation (must be less than 0.5). |
Hamming | A Hamming window. |
Hanning | A Hann or Hanning window. |
ModifiedBartlettHann | A modified Bartlett-Hann window. |
Nuttall | A Blackman-Nuttal window. |
Rectangular | A rectangular window. |
Triangular | A triangular window. |
Tukey | A Tukey window with specified ratio of the tapered section to the constant section. |
Window functions are applied by multiplying the components
of a signal with the corresponding weight in the window function.
The WindowFunction
type has a multiplication operator and corresponding static
Multiply
method that performs this operation on a real signal, represented by a
VectorT,
or a complex signal, represented by a
VectorT of ComplexT.
The original signal is unmodified.
The resulting signal vector always has the same length
as the original signal. If a window is shorter than the signal, then the
trailing part of the result is padded with zeros.
Individual weights of the window can be accessed
using the
Item
indexer property. All weights can also be obtained in an array or a
VectorT
by calling the
ToArray
or ToVector
method, respectively.