Class: SPCore::GaussianWindow
- Inherits:
-
Object
- Object
- SPCore::GaussianWindow
- Defined in:
- lib/spcore/windows/gaussian_window.rb
Overview
For more info, see en.wikipedia.org/wiki/Window_function#Gaussian_windows.
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Instance Method Summary collapse
-
#initialize(size) ⇒ GaussianWindow
constructor
A new instance of GaussianWindow.
Constructor Details
#initialize(size) ⇒ GaussianWindow
Returns a new instance of GaussianWindow.
6 7 8 9 10 11 12 13 |
# File 'lib/spcore/windows/gaussian_window.rb', line 6 def initialize size @data = Array.new size sigma = 0.4 # must be <= 0.5 size.times do |n| a = (n - (size - 1) / 2) / (sigma * (size - 1) / 2) @data[n] = Math::exp(-0.5 * a**2) end end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
5 6 7 |
# File 'lib/spcore/windows/gaussian_window.rb', line 5 def data @data end |