Class: SpectrumAnalyzer::WindowFunctions
- Inherits:
-
Object
- Object
- SpectrumAnalyzer::WindowFunctions
- Defined in:
- lib/spectrum-analyzer/clients/window_functions.rb
Instance Method Summary collapse
- #hanning ⇒ Object
-
#initialize(window_size) ⇒ WindowFunctions
constructor
A new instance of WindowFunctions.
- #rectangle ⇒ Object
Constructor Details
#initialize(window_size) ⇒ WindowFunctions
Returns a new instance of WindowFunctions.
3 4 5 |
# File 'lib/spectrum-analyzer/clients/window_functions.rb', line 3 def initialize(window_size) @window_size = window_size end |
Instance Method Details
#hanning ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/spectrum-analyzer/clients/window_functions.rb', line 6 def hanning hannified_array = Array.new i=0 (0..@window_size).each { |x| hannified_array[i] = 0.5 - 0.5 * Math.cos(2 * Math::PI * i / @window_size) ; i+=1} hannified_array end |
#rectangle ⇒ Object
14 15 16 |
# File 'lib/spectrum-analyzer/clients/window_functions.rb', line 14 def rectangle Array.new(@window_size, 1) end |