Learn R Programming

phonTools (version 0.2-2.2)

windowfunc: Window Function

Description

Generates a window function of a given type and length.

Usage

windowfunc (npoints, type = 'hann', parameter = -1)

Arguments

npoints

The desired window length, in points. If a vector is given, the window will have the same length as the vector.

type

A string indicating the type of window desired. For the sake of simplicity, all window names are in lowercase. Supported types are: rectangular, hann, hamming, cosine, bartlett, gausian, and kaiser.

parameter

The parameter necessary to generate the window, if appropriate. At the moment, the only windows that require parameters are the Kaiser and Gaussian windows. By default, these are set to 2 for kaiser and 0.4 for gaussian windows.

Author

Santiago Barreda <sbarreda@ucdavis.edu>

Details

A window function is generated, of the type and length specified by the user. This is returned as a numeric vector.

References

http://en.wikipedia.org/wiki/Window_function

Examples

Run this code
#par (mfrow = c(1,4))
#plot (windowfunc (100, 'hann'))
#plot (windowfunc (100, 'bartlett'))
#plot (windowfunc (100, 'kaiser', parameter = 2))
#plot (windowfunc (100, 'kaiser', parameter = 6))

Run the code above in your browser using DataLab