Class: SPCore::NuttallWindow
- Inherits:
-
Object
- Object
- SPCore::NuttallWindow
- Defined in:
- lib/spcore/windows/nuttall_window.rb
Overview
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Instance Method Summary collapse
-
#initialize(size) ⇒ NuttallWindow
constructor
A new instance of NuttallWindow.
Constructor Details
#initialize(size) ⇒ NuttallWindow
Returns a new instance of NuttallWindow.
6 7 8 9 10 11 12 |
# File 'lib/spcore/windows/nuttall_window.rb', line 6 def initialize size @data = Array.new(size) a0, a1, a2, a3 = 0.355768, 0.487396, 0.144232, 0.012604 size.times do |n| @data[n] = a0 - a1 * Math::cos((TWO_PI * n)/(size - 1)) + a2 * Math::cos((FOUR_PI * n)/(size - 1)) - a3 * Math::cos((SIX_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/nuttall_window.rb', line 5 def data @data end |