Last data update: 2014.03.03

R: Computes the Coefficients of a Hanning or Uniform Window.
hanning.windowR Documentation

Computes the Coefficients of a Hanning or Uniform Window.

Description

For hanning.window, the filter coefficients w(i) of a Hanning window of length n are computed according to the formula

w(i) = 0.5 - 0.5*cos(2*pi*i/(n-1))

For uniform.window, a constant value 1 is repeated for the length(n).

Usage

hanning.window(n)
uniform.window(n)

Arguments

n

The length of the window.

Value

A vector containing the filter coefficients.

Author(s)

Andreas Weingessel

References

For a definition of the Hanning window, see for example
Alan V. Oppenheim and Roland W. Schafer: "Discrete-Time Signal Processing", Prentice-Hall, 1989.

See Also

stft

Examples

hanning.window(10)

x<-rnorm(500)
y<-stft(x, wtype="hanning.window")
plot(y)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(GENEAread)
Loading required package: bitops
GENEAread 1.1.1 loaded

> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/GENEAread/hanning.window.Rd_%03d_medium.png", width=480, height=480)
> ### Name: hanning.window
> ### Title: Computes the Coefficients of a Hanning or Uniform Window.
> ### Aliases: hanning.window uniform.window
> ### Keywords: ts
> 
> ### ** Examples
> hanning.window(10)
 [1] 0.000000000000 0.116977778441 0.413175911167 0.750000000000 0.969846310393
 [6] 0.969846310393 0.750000000000 0.413175911167 0.116977778441 0.000000000000
> 
> x<-rnorm(500)
> y<-stft(x, wtype="hanning.window")
================================================================================
> plot(y)
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>