class SPCore::GaussianWindow

Produces a Gaussian window of a given size (number of samples). For more info, see en.wikipedia.org/wiki/Window_function#Gaussian_windows.

Attributes

data[R]

Public Class Methods

new(size) click to toggle source
# File lib/spcore/windows/gaussian_window.rb, line 6
def initialize size
  @data = Array.new size
  sigma = 0.4 # must be <= 0.5
  size.times do |n|
    a = (n - (size - 1) / 2) / (sigma * (size - 1) / 2)
    @data[n] = Math::exp(-0.5 * a**2)
  end
end