Class: SPCore::BlackmanNuttallWindow
- Inherits:
-
Object
- Object
- SPCore::BlackmanNuttallWindow
- Defined in:
- lib/spcore/windows/blackman_nuttall_window.rb
Overview
For more info, see en.wikipedia.org/wiki/Window_function#Blackman.E2.80.93Nuttall_window.
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Instance Method Summary collapse
-
#initialize(size) ⇒ BlackmanNuttallWindow
constructor
A new instance of BlackmanNuttallWindow.
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
#data ⇒ Object (readonly)
Returns the value of attribute data.
5 6 7 |
# File 'lib/spcore/windows/blackman_nuttall_window.rb', line 5 def data @data end |