class SPCore::HammingWindow

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

Attributes

data[R]

Public Class Methods

new(size) click to toggle source
# File lib/spcore/windows/hamming_window.rb, line 6
def initialize size
  @data = Array.new size
  alpha = 0.54
  beta = 1.0 - alpha
    
  size.times do |n|
    @data[n] = alpha - (beta * Math::cos((TWO_PI * n) / (size - 1)))
  end
end