Accelerating the pace of engineering and science

# flattopwin

Flat top weighted window

## Syntax

w = flattopwin(L)
w = flattopwin(L,sflag)

## Description

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.

w = flattopwin(L) returns the L-point symmetric flat top window in column vector w.

w = flattopwin(L,sflag) returns the L-point symmetric flat top window using sflag window sampling, where sflag is either 'symmetric' or 'periodic'. The 'periodic' flag is useful for DFT/FFT purposes, such as in spectral analysis. The DFT/FFT contains an implicit periodic extension and the periodic flag enables a signal windowed with a periodic window to have perfect periodic extension. When 'periodic' is specified, flattopwin computes a length L+1 window and returns the first L points. When using windows for filter design, the 'symmetric' flag should be used.

## Examples

expand all

### Flat Top Window

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

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

expand all

### Algorithms

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

$w\left(n\right)={a}_{0}-{a}_{1}\mathrm{cos}\left(\frac{2\pi n}{N-1}\right)+{a}_{2}\mathrm{cos}\left(\frac{4\pi n}{N-1}\right)-{a}_{3}\mathrm{cos}\left(\frac{6\pi n}{N-1}\right)+{a}_{4}\mathrm{cos}\left(\frac{8\pi n}{N-1}\right),$

where $0\le n\le N-1$. The coefficient values are

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

## 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, No. 3, 1987, pp. 1–28.