Main Content

flattopwin

Flat top weighted window

Description

w = flattopwin(L) returns an L-point symmetric flat top window

example

w = flattopwin(L,sflag) returns an L-point symmetric flat top window using the window sampling method specified by sflag.

w = flattopwin(___,typeName) specifies the option to return the window w with single or double precision.

Examples

collapse all

Create a 64-point symmetric flat top window. View the result using wvtool.

N = 64;
w = flattopwin(N);
wvtool(w)

Figure Window Visualization Tool contains 2 axes objects and other objects of type uimenu, uitoolbar, uipanel. Axes object 1 with title Time domain, xlabel Samples, ylabel Amplitude contains an object of type line. Axes object 2 with title Frequency domain, xlabel Normalized Frequency (\times\pi rad/sample), ylabel Magnitude (dB) contains an object of type line.

Input Arguments

collapse all

Window length, specified as a positive integer.

Note

If you specify L as noninteger, the function rounds it to the nearest integer value.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

Window sampling method, specified as:

  • "symmetric" — Use this option when using windows for filter design.

  • "periodic" — Use this option when using windows for spectral analysis. When you specify "periodic", flattopwin computes a window of length L + 1 and returns the first L points. The missing endpoint is the beginning of the next period of the periodic extension of the sequence. Therefore, the sequence satisfies the periodicity assumption of the discrete Fourier transform.

Data Types: char | string

Since R2024b

Output data type (class), specified as one of these:

  • "double" — Use this option to return a double-precision output w.

  • "single" — Use this option to return a single-precision output w.

Data Types: char | string

Output Arguments

collapse all

Flat top window, returned as a column vector.

Algorithms

Flat top windows are summations of cosines. The coefficients of a flat top window are computed from the following equation:

w(n)=a0a1cos(2πnL1)+a2cos(4πnL1)a3cos(6πnL1)+a4cos(8πnL1),

where 0nL1. The coefficient values are:

CoefficientValue
a00.21557895
a10.41663158
a20.277263158
a30.083578947
a40.006947368

Flat top windows have very low passband ripple (< 0.01 dB) and are used primarily for calibration purposes. Their bandwidth is approximately 2.5 times wider than a Hann window.

References

[1] D’Antona, Gabriele, and A. Ferrero. Digital Signal Processing for Measurement Systems. New York: Springer Media, 2006, pp. 70–72.

[2] Gade, Svend, and Henrik Herlufsen. “Use of Weighting Functions in DFT/FFT Analysis (Part I).” Windows to FFT Analysis (Part I): Brüel & Kjær Technical Review. Vol. x, Number 3, 1987, pp. 1–28.

Extended Capabilities

expand all

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

GPU Code Generation
Generate CUDA® code for NVIDIA® GPUs using GPU Coder™.

Version History

Introduced before R2006a

expand all

See Also

Apps

Functions