Class: SPCore::HammingWindow
- Inherits:
-
Object
- Object
- SPCore::HammingWindow
- Defined in:
- lib/spcore/windows/hamming_window.rb
Overview
For more info, see en.wikipedia.org/wiki/Window_function#Hamming_window.
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Instance Method Summary collapse
-
#initialize(size) ⇒ HammingWindow
constructor
A new instance of HammingWindow.
Constructor Details
#initialize(size) ⇒ HammingWindow
Returns a new instance of HammingWindow.
6 7 8 9 10 11 12 13 14 |
# 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 |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
5 6 7 |
# File 'lib/spcore/windows/hamming_window.rb', line 5 def data @data end |