Class: SPCore::BartlettHannWindow
- Inherits:
-
Object
- Object
- SPCore::BartlettHannWindow
- Defined in:
- lib/spcore/windows/bartlett_hann_window.rb
Overview
For more info, see en.wikipedia.org/wiki/Window_function#Bartlett.E2.80.93Hann_window.
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Instance Method Summary collapse
-
#initialize(size) ⇒ BartlettHannWindow
constructor
A new instance of BartlettHannWindow.
Constructor Details
#initialize(size) ⇒ BartlettHannWindow
Returns a new instance of BartlettHannWindow.
6 7 8 9 10 11 12 13 |
# File 'lib/spcore/windows/bartlett_hann_window.rb', line 6 def initialize size @data = Array.new(size) a0, a1, a2 = 0.62, 0.48, 0.38 size.times do |n| @data[n] = a0 - (a1 * ((n.to_f / (size - 1)) - 0.5).abs) - (a2 * 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/bartlett_hann_window.rb', line 5 def data @data end |