class SPCore::TriangularWindow

Produces a triangular window of a given size (number of samples). Endpoints are near zero. Midpoint is one. There is a linear slope between endpoints and midpoint. For more info, see en.wikipedia.org/wiki/Window_function#Triangular_window

Attributes

data[R]

Public Class Methods

new(size) click to toggle source
# File lib/spcore/windows/triangular_window.rb, line 7
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