class Digiproc::HighpassFilter

Creates a highpass filter via the windowing method

Attributes

equation[RW]

Public Class Methods

new(size:, window: RectangularWindow, wc: , correct: true) click to toggle source

Inputs

size
Integer

number of datapoints window should be

window
Digiproc::WindowStrategy

desired window strategy

wo
Float

center frequency in radians

bw
Float

bandwidth in radians

correct
Boolean

perform frequency corrections to make frequency points more accurate. Defaults to true

Digiproc::BandpassFilter.new(size: 1000, wo: Math::PI / 4, bw: Math::PI / 10)
Calls superclass method Digiproc::DigitalFilter::new
# File lib/filters/highpass_filter.rb, line 15
def initialize(size:, window: RectangularWindow, wc: , correct: true)
    super(size: size, window: window)
    wc = wc - @window.transition_width * PI if correct
    @equation = ->(n){ 
        n == 0 ?  (( PI - wc) / PI) :  (-1 * (Math.sin( wc * n) / (PI * n)))
    }
    ideal_filter = calculate_ideal
    @weights = self.window.values.times ideal_filter
    @fft = FFT.new(data: self.weights)
    @fft.calculate
end