WINFUNC

Purpose:

Multiplies a series with a spectral window.

Syntax:

WINFUNC(func, series, ampflag, beta, "sym")

func

-

An integer, the windowing function. Valid inputs are:

0:

Hamming

1:

Hanning

2:

Rectangular (none)

3:

Kaiser

4:

Flattop

5:

Blackman

6:

Modified Flattop

7:

Dolph-Chebychev

8:

Taylor

9:

Blackman-Harris

series

-

A series or array.

ampflag

-

Optional. An integer, the window correction method.

0:

do not correct amplitude (default)

1:

correct amplitude

2:

correct RMS amplitude

3:

correct mean-squared amplitude

beta

-

Optional. A real, beta value for the Kaiser window. Defaults to 7.865. For a Flattop window, beta determines the Flattop window coefficients. For a Dolph-Chebyshev, beta determines the attenuation and for a Taylor window, beta determines the number of constant level sidelobes. See GFLATTOP, GCHEBWIN and GTAYLORWIN for details.

"sym"

-

Optional. A string, the window symmetry flag.

"symmetric"

:

Starting and ending points are equal, but leading and trailing zeros are removed (default).

"periodic"

:

periodically extended window where the symmetric end point is removed. Conforms to the ISO standard.

"direct"

:

Starting and ending points are equal, any leading and trailing zeros are preserved. Same as "symmetric" in all cases except Hanning.

"iso"

:

Same as "periodic".

Returns:

A series or array.

Example:

W1: gsin(1000, .001, 45)

W2: spectrum(winfunc(0, W1))

W3: spectrum(winfunc(0, W1, 1))

 

The MAX of W2 == 0.539 and the MAX of W3 == 1.0. The amplitude of the spectrum in W3 has been corrected to take into account amplitude effects of the Hamming window.

Remarks:

WINFUNC is the core routine for the BLACKMAN, BLACKMANHARRIS, FLATTOP, HAMMING, HANNING and KAISER SPL functions.

 

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 = winfun(s) * rms(s) / rms(winfun(s)) 

 

where winfun is Blackman, Blackmanharris, Flattop, Hamming, Hanning or Kaiser. 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 "sym" flag controls the window symmetry as follows:

 

"Symmetric" (the default) removes any leading and trailing zeros. For an N point symmetric window, a N-1 point periodic window is effectively created and the Nth point is set to the same value as the first point. For the Hanning window, a N+1 point periodic window is created and the trailing zero is removed.

 

"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.

 

"Direct" implements the core window function where any leading and trailing zeros are preserved. This mode is the same as "symmetric" for all windows except Hanning.

 

"Sym" defaults to "periodic" for Flattop and "symmetric" for all other windows.

 

For a Taylor window, this flag is a real and sets the stopband attenuation.

 

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. For the symmetric Hanning window, a N+1 periodic window is created and the trailing zero is removed.

 

For the cosine windows, the default coefficients are as follows:

 

Hamming:

 

Hanning:

 

Flattop:

 

Blackman:

 

Blackman-Harris:

See Also:

BLACKMAN

BLACKMANHARRIS

CHEBWIN

FLATTOP

FLATTOPWIN

HAMMING

HANNING

KAISER

TAYLORWIN