bartlett, hamming, hanning, rectangle, triangle

[ XITE Reference Manual | XITE home ]

Name

bartlett, hamming, hanning, rectangle, triangle, parseWindowName - circularly symmetric window functions for filters and parsing of window function name

Syntax

 #include <xite/ideal.h>

 double bartlett (double n, int size);
 double hamming (double n, int size);
 double hanning (double n, int size);
 double rectangle (double n, int size);
 double triangle (double n, int size);
 window_type parseWindowName(char *name);

Description

The bartlett, hamming, hanning (von Hann), rectangle (box, boxcar) and triangle functions return function values for the various windows, at a certain distance n. size is the diameter of the window function.

Window functions are typically used to multiply with a filter in the spatial domain.

These functions should only be called when
 0 <= n < size
Outside this interval, the functions should be considered equal to zero.

rectangle is given by
 w(n)=1.0

bartlett is given by
      2n/(size-1),     n<=(size-1)/2
 w(n)=
      2-2n/(size-1),   n>(size-1)/2

triangle is given by
      2(n+1)/(size+1),   n<=(size-1)/2
 w(n)=
      2-2(n+1)/(size+1), n>(size-1)/2
triangle is almost the same as bartlett, but triangle does not include zeros at the end-points.

hamming is given by
 w(n)=0.54-0.46*cos(2 Pi n/(size-1))

hanning is given by
 w(n)=0.5-0.5*cos(2 Pi (n+1)/(size+1))
hanning is sometimes defined slightly different. This version does not include zeros at the end-points.

parseWindowName returns a symbolic integer value for various forms of window name. Legal forms of name are

 Full name  Short name  Number
 -----------------------------
 rectangle      r         RECTANGLE
 bartlett       b         BARTLETT
 triangle       t         TRIANGLE
 hamming        hm        HAMMING
 hanning        hn        HANNING

Return value

Function value.

See also

window(3), lowpass(3), lowpassf(3)

Author

Trond Muri Sørensen, Svein Bøe