tukeywindow {bspec} R Documentation

## Compute windowing functions for spectral time series analysis.

### Description

Several windowing functions for spectral or Fourier analysis of time series data are provided.

### Usage

```tukeywindow(N, r = 0.1)
squarewindow(N)
hannwindow(N)
welchwindow(N)
trianglewindow(N)
hammingwindow(N, alpha=0.543478261)
cosinewindow(N, alpha=1)
kaiserwindow(N, alpha=3)
```

### Arguments

 `N` the length of the time series to be windowed `r` the Tukey window's parameter, denoting the its "non-flat" fraction. `alpha` additional parameter for Hamming-, cosine-, and Kaiser-windows.

### Details

Windowing of time series data, i.e., multiplication with a tapering function, is often useful in spectral or Fourier analysis in order to reduce "leakage" effects due to the discrete and finite sampling. These functions provide windowing coefficients for a given sample size `N`.

### Value

A vector (of length `N`) of windowing coefficients.

### Author(s)

Christian Roever, christian.roever@med.uni-goettingen.de

### References

Harris, F. J. On the use of windows for harmonic analysis with the discrete Fourier transform. Proceedings of the IEEE, 66(1):51–83, 1978.

Press, W. H., Teukolsky, S. A., Vetterling, W. T., Flannery, B. P. Numerical recipes in C. Cambridge University Press, 1992.

`welchPSD`, `empiricalSpectrum`

### Examples

```# illustrate the different windows' shapes:
N <- 100
matplot(1:N,
cbind(cosinewindow(N),
hammingwindow(N),
hannwindow(N),
kaiserwindow(N),
squarewindow(N),
trianglewindow(N),
tukeywindow(N,r=0.5),
welchwindow(N)),
type="l", lty="solid", col=1:8)
legend(N, 0.99, legend=c("cosine","hamming","hann","kaiser",
"square","triangle","tukey","welch"),
col=1:8, lty="solid", xjust=1, yjust=1, bg="white")

# show their effect on PSD estimation:
data(sunspots)

spec1 <- welchPSD(sunspots, seglength=10, windowfun=squarewindow)
plot(spec1\$frequency, spec1\$power, log="y", type="l")

spec2 <- welchPSD(sunspots, seglength=10, windowfun=tukeywindow, r=0.25)
lines(spec2\$frequency, spec2\$power, log="y", type="l", col="red")

spec3 <- welchPSD(sunspots, seglength=10, windowfun=trianglewindow)
lines(spec3\$frequency, spec3\$power, log="y", type="l", col="green")
```

[Package bspec version 1.5 Index]