# FLATTOP

## Purpose:

Multiplies a series with a Flattop window.

## Syntax:

FLATTOP(series, ampflag, type, "sym")

series

-

A series or array.

ampflag

-

Optional. An integer, the amplitude correction flag:

 0 : do not correct amplitude (default) 1 : correct amplitude 2 : correct RMS amplitude 3 : correct mean squared amplitude

type

-

Optional. An integer, the window generation method:

 0 : ISO 18431-1 4 point method (default) 1 : 2 point formula 2 : Alternate 4 point formula 3 : HP P301 4 : HP 4 point formula 5 : Modified HP P401 5 point formula 6 : Rohde & Schwartz 4 point formula

"sym"

-

Optional. A string, the symmetry flag:

 "symmetric" : Starting and ending points are equal. "periodic" : Periodically extended window where the symmetric end point is removed. Conforms to the ISO standard (default). "iso" : Same as "periodic"

## Alternate Syntax:

FLATTOP(N, ampflag, type, "sym")

N

-

An integer, the length of the window.

ampflag

-

Optional. An integer, the amplitude correction flag:

 0 : do not correct amplitude (default) 1 : correct amplitude 2 : correct RMS amplitude 3 : correct mean squared amplitude

type

-

Optional. An integer, the window generation method:

 0 : ISO 18431-1 4 point method (default) 1 : 2 point formula 2 : Alternate 4 point formula 3 : HP P301 4 : HP 4 point formula 5 : Modified HP P401 5 point formula 6 : Rohde & Schwartz 4 point formula

"sym"

-

Optional. A string, the symmetry flag:

 "symmetric" : Starting and ending points are equal. "periodic" : Periodically extended window where the symmetric end point is removed. Conforms to the ISO standard (default). "iso" : Same as "periodic"

## Returns:

A series or array.

## Example:

W1: gsin(1000, .001, 45)

W2: spectrum(flattop(W1))

The MAX of W2 == 1.0 at 45 Hertz.

## Example:

W3: flattop(1000, "symmetric")

Generates a 1000 point symmetric flattop window.

## Remarks:

The Flattop window preserves the amplitude of a series at the expense of frequency resolution. It will accurately measure the amplitude of a series at any frequency, even if the frequency lies between FFT bins.

If ampflag == 1, the correction factor is the mean of the spectral window. This assures that the spectrum of a sinusoid of amplitude A has a peak of A.

If ampflag == 2, the correction is applied as follows:

w = flattop(s) * rms(s) / rms(flattop(s))

This assures that:

sqrt(area(psd(w))) == rms(s) approximately

If ampflag == 3, the correction is applied as follows:

w = winfun(s) / sqrt(mean(win * win)

where win is the windowing function.

The periodic flattop window is constructed by the formula of the form: where N is the length of the window and n is the nth point (1 <= n <= N).

The symmetric flattop window is constructed by the formula of the form: where N is the length of the window and n is the nth point (1 <= n <= N).

The type parameter specifies the values of the flattop window coefficients. The following types are supported:

For type 0, ISO 18431-1 (default): For type 1, two point flattop window: For type 2, alternate four point flattop window: For type 3, three point HP P301 flattop window: For type 4, HP four point window: For type 5, modified HP P401 five point window: For type 6, Rohde & Schwartz four point window: The "sym" flag controls the window symmetry as follows:

"Symmetric" sets the last point to be the same value as the first point. For an N point symmetric window, a N-1 point periodic window is effectively created and the Nth point is set to the first point.

"Periodic" or "iso" creates a periodic window function useful in spectrum analysis applications where the starting zero is preserved and the trailing zero is removed. "Periodic" or "iso" conforms to the ISO 18431-1 standard for windowing functions.

The Hamming, Hanning, Flattop and Blackman windows are part of the family of cosine window functions. The ISO 18431-1 standard periodic form of these windowing functions are defined by: where K is the number of window coefficients and N is the length of the window. The symmetric form of the window can be constructed by setting N to N-1.

Because the ISO 18431-1 standard specifies a periodic flattop window, FLATTOP uses "periodic" as the default for the "sym" flag.

See GFLATTOP to generate a Flattop window.

See FLATTOPWIN for an implementation of the alternative 4 term flattop window (type == 2).

BLACKMAN

FLATTOPWIN

GFLATTOP

GFLATTOPWIN

HAMMING

HANNING

KAISER

PSD

SPECTRUM

WINFUNC