Class: SPCore::BlackmanNuttallWindow

Inherits:
Object
  • Object
show all
Defined in:
lib/spcore/windows/blackman_nuttall_window.rb

Overview

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(size) ⇒ BlackmanNuttallWindow

Returns a new instance of BlackmanNuttallWindow.



6
7
8
9
10
11
12
# File 'lib/spcore/windows/blackman_nuttall_window.rb', line 6

def initialize size
  @data = Array.new(size)
  a0, a1, a2, a3 = 0.3635819, 0.4891775, 0.1365995, 0.0106411
  size.times do |n|
    @data[n] = a0 - a1 * Math::cos((TWO_PI * n)/(size - 1)) + a2 * Math::cos((FOUR_PI * n)/(size - 1)) - a3 * Math::cos((SIX_PI * n)/(size - 1))
  end
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



5
6
7
# File 'lib/spcore/windows/blackman_nuttall_window.rb', line 5

def data
  @data
end