Learn R Programming

gsignal (version 0.3-1)

gaussian: 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.

Value

Gaussian convolution window, returned as a vector.

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).

Examples

Run this code
# NOT RUN {
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")

# }

Run the code above in your browser using DataLab