Class: SPCore::HannWindow
- Inherits:
-
Object
- Object
- SPCore::HannWindow
- Defined in:
- lib/spcore/windows/hann_window.rb
Overview
For more info, see en.wikipedia.org/wiki/Window_function#Hann_.28Hanning.29_window.
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Instance Method Summary collapse
-
#initialize(size) ⇒ HannWindow
constructor
A new instance of HannWindow.
Constructor Details
#initialize(size) ⇒ HannWindow
Returns a new instance of HannWindow.
6 7 8 9 10 11 |
# File 'lib/spcore/windows/hann_window.rb', line 6 def initialize size @data = Array.new(size) size.times do |n| @data[n] = 0.5 * (1 - 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/hann_window.rb', line 5 def data @data end |