Sha256: f7cce550bc1d027fa2a39f43fb9fe7b37f707a933e3702852ea60c2bbd1c3c4c
Contents?: true
Size: 429 Bytes
Versions: 9
Compression:
Stored size: 429 Bytes
Contents
module SPCore # Produces a Gaussian window of a given size (number of samples). # For more info, see https://en.wikipedia.org/wiki/Window_function#Gaussian_windows. class GaussianWindow attr_reader :data 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 end end
Version data entries
9 entries across 9 versions & 1 rubygems