Class: SPCore::GaussianWindow

Inherits:
Object
  • Object
show all
Defined in:
lib/spcore/windows/gaussian_window.rb

Overview

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#dataObject (readonly)

Returns the value of attribute data.



5
6
7
# File 'lib/spcore/windows/gaussian_window.rb', line 5

def data
  @data
end