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