Class: SPCore::BartlettWindow
- Inherits:
-
Object
- Object
- SPCore::BartlettWindow
- Defined in:
- lib/spcore/windows/bartlett_window.rb
Overview
Endpoints are zero. Midpoint is one. There is a linear slope between endpoints and midpoint.
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Instance Method Summary collapse
-
#initialize(size) ⇒ BartlettWindow
constructor
A new instance of BartlettWindow.
Constructor Details
#initialize(size) ⇒ BartlettWindow
Returns a new instance of BartlettWindow.
6 7 8 9 10 11 |
# File 'lib/spcore/windows/bartlett_window.rb', line 6 def initialize size @data = Array.new(size) size.times do |n| @data[n] = (2.0 / (size - 1)) * (((size - 1) / 2.0) - (n - ((size - 1) / 2.0)).abs) end end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
5 6 7 |
# File 'lib/spcore/windows/bartlett_window.rb', line 5 def data @data end |