window_ec: 1D Window Functions.

View source: R/windows.R

window_ecR Documentation

1D Window Functions.

Description

A window function in this context is a continuous nondecreasing function such that at 0 it is 0, and at 1, it is 1. Note that window() is deprecated, please use window_ec() instead. This computes one of the window functions listed below.

Usage

window_ec(
  x,
  name = c("tukey", "triangular", "sine", "power_sine", "blackman", "hann_poisson",
    "welch"),
  params = c(1)
)

Arguments

x

A vector or matrix of arguments of at least length 1. Each value must be between 0 and 1, inclusive.

name

The name of the window. Options are: tukey, triangular, sine, power_sine, blackman, hann_poisson, welch.

params

A vector of parameters for the windows. See the documentation below for the position of the parameters.

Details

Tukey Window. The Tukey window is defined as

w(x) = \frac{1}{2} - \frac{1}{2} \cos(\pi x) , x \in [0, 1].

The params argument is empty.

Triangular Window. The triangular window is given by

w(x) = x, x \in [0, 1].

The params argument is empty.

Sine Window. The sine window is given by

w(x) = \sin\left(\pi x / 2 \right), x \in [0, 1].

The params argument is empty.

Power Sine Window. The power sine window is given by

w(x; a) = \sin^{a}(\pi x / 2), x \in [0, 1], a > 0.

The params argument is of the form c(a).

Blackman Window. The Blackman window is defined as

w(x; a) = ( (1 - a) / 2) - \frac{1}{2} \cos(\pi x) + \frac{a}{2} \cos(2 \pi x), x \in [0, 1], a \in [-0.25, 0.25] .

The params argument is of the form c(a). It is recommended that a \in [-0.25, 0.25] to ensure that the window is nondecreasi#'ng on [0, 1].

Hann-Poisson Window. The Hann-Poisson window is defined as

w(x; a) = \frac{1}{2} (1 - \cos(\pi x)) \exp( - (a \left|1 - x \right|) ) , x \in [0, 1], a > 0.

The params argument is of the form c(a).

Welch Window. The Welch window is given by

w(x) = 1 - (x - 1)^2 , x \in [0, 1] .

The params argument is empty.

See the function call examples below.

Value

A vector or matrix of values.

Examples

x <- c(0.2, 0.4, 0.6)
window_ec(x, "tukey")
window_ec(x, "triangular")
window_ec(x, "sine")
window_ec(x, "power_sine", c(0.7))
window_ec(x, "blackman", c(0.16))
window_ec(x, "hann_poisson", c(0.7))
window_ec(x, "welch")
curve(window_ec(x, "tukey"), from = 0, to = 1)
curve(window_ec(x, "triangular"), from = 0, to = 1)
curve(window_ec(x, "sine"), from = 0, to = 1)
curve(window_ec(x, "power_sine", c(0.7)), from = 0, to = 1)
curve(window_ec(x, "blackman", c(0.16)), from = 0, to = 1)
curve(window_ec(x, "hann_poisson", c(0.7)), from = 0, to = 1)
curve(window_ec(x, "welch"), from = 0, to = 1)

CovEsts documentation built on April 19, 2026, 5:06 p.m.

Related to window_ec in CovEsts...