gaussian: Gaussian convolution window

View source: R/gaussian.R

gaussianR Documentation

Gaussian convolution window

Description

Return a Gaussian convolution window of length n.

Usage

gaussian(n, a = 1)

Arguments

n

Window length, specified as a positive integer.

a

Width factor, specified as a positive real scalar. a is inversely proportional to the width of the window. Default: 1.

Details

The width of the window is inversely proportional to the parameter a. Use larger a for a narrower window. Use larger m for longer tails.

w = e^{(-(a*x)^{2}/2 )}

for x <- seq(-(n - 1) / 2, (n - 1) / 2, by = n).

Width a is measured in frequency units (sample rate/num samples). It should be f when multiplying in the time domain, but 1/f when multiplying in the frequency domain (for use in convolutions).

Value

Gaussian convolution window, returned as a vector.

Author(s)

Paul Kienzle, pkienzle@users.sf.net.
Conversion to R by Geert van Boxtel G.J.M.vanBoxtel@gmail.com.

Examples


g1 <- gaussian(128, 1)
g2 <- gaussian(128, 0.5)
plot (g1, type = "l", xlab = "Samples", ylab =" Amplitude", ylim = c(0, 1))
lines(g2, col = "red")


gsignal documentation built on Sept. 12, 2024, 6:27 a.m.