FIRWIN Function

Computes one of several different data windows: Blackman, Chebyshev, Hamming, Hanning, Kaiser, rectangular, or triangular.

Usage

result = FIRWIN(n[, a])

Input Parameters

n—The length of the window sequence.

a—(optional) A scalar float parameter used only when computing either the Kaiser or Chebyshev windows.

Returned Value

result—A one-dimensional array containing the requested window.

Keywords

Blackman—If set, a Blackman window is returned.

Chebyshev—If set, a Chebyshev window is returned. If Chebyshev is set, input parameter a (a*p is q0 in the Chebyshev window equation) is also required.

Hamming—If set, a Hamming window is returned.

Hanning—If set, a Hanning window is returned.

Kaiser—If set, a Kaiser window is returned. If Kaiser is set, input parameter a (a*p is a in the Kaiser window equation) is also required.

Rectangular—If set, a rectangular window is returned. This is also known as a boxcar window.

Triangular—If set, a triangular window is returned.

Window_type—A scalar value (see the following table) used to specify a window type. This keyword may be used in place of the particular window keywords:

1—Rectangular

2—Triangular

3—Hanning

4—Hamming

5—Kaiser

6—Blackman

7—Chebyshev

Discussion

A listing of the applicable time domain equations is given below, where (0 < n < N – 1) for each of the windows.

Blackman window:

 

Chebyshev window:

 

 

 

where:

 

and q0 is the FIRWIN input parameter a*p and where j=2, ..., (n–1)/2.

Hamming window:

 

Hanning window:

 

Kaiser window:

 

where I0(x) is the zeroth order Bessel function of the first kind, and a is the FIRWIN input parameter a.

Rectangular (or boxcar) window:

w(n) = 1, for all n

Triangular window:

, for all n.

Example

This example illustrates how to generate each of the different window types for a window length of 31. The results are shown in FIRWIN Window Type Plots, where (a) is rectangular and triangular windows; (b) is Hanning and Hamming windows; (c) is Kaiser and Blackman windows; and (d) is Chebyshev window.

!P.Multi=[0,2,2]
n = 31
rect = FIRWIN(n, /Rectangular)
tri = FIRWIN(n, /Triangular)
hann = FIRWIN(n, /Hanning)
hamm = FIRWIN(n, /Hamming)
kaiser = FIRWIN(n, 0.5, /Kaiser)
black = FIRWIN(n, /Blackman)
cheby = FIRWIN(n, 0.15, /Chebyshev)
; Plot the rectangular and triangular windows.
PLOT, rect, Linestyle = 2, XStyle = 1, YRange = [0, 1.05], $
Title = 'Rectangular and Triangular'
OPLOT, tri
; Plot the Hanning and Hamming windows.
PLOT, hann, XStyle = 1, Linestyle = 2, YRange = [0, 1.05], $
Title = 'Hanning and Hamming'
OPLOT, hamm
; Plot the Kaiser and Blackman windows.
PLOT, kaiser, XStyle = 1, Linestyle = 2, YRange = [0, 1.05],$
Title = 'Kaiser and Blackman'
OPLOT, black
; Plot a Chebyshev window.
PLOT, cheby, XStyle = 1, YRange = [0, 1.05], Title = 'Chebyshev'

 

FIRWIN Window Type Plots

See Also

FIRDESIGN, FIRFILT, FIRLS

For Additional Information

Harris, 1978.

Roberts and Mullis, 1987.