Class: Digiproc::KaiserWindow
- Inherits:
-
WindowStrategy
- Object
- WindowStrategy
- Digiproc::KaiserWindow
- Defined in:
- lib/strategies/window/kaiser_window.rb
Overview
kaiser Window Used to improve digital filters by using a non-retangular frequency domain window NOT COMPLETE TODO: Finish this Window
Constant Summary
Constants inherited from WindowStrategy
Instance Attribute Summary
Attributes inherited from WindowStrategy
#data, #equation, #size, #values
Instance Method Summary collapse
- #beta_for_db(db) ⇒ Object
-
#initialize(size:, stopband_db: nil, beta: nil) ⇒ KaiserWindow
constructor
A new instance of KaiserWindow.
Methods inherited from WindowStrategy
#calculate, #make_odd, #to_signal
Constructor Details
#initialize(size:, stopband_db: nil, beta: nil) ⇒ KaiserWindow
Returns a new instance of KaiserWindow.
9 10 11 12 13 14 15 16 |
# File 'lib/strategies/window/kaiser_window.rb', line 9 def initialize(size: , stopband_db: nil, beta: nil) raise ArgumentError.new("Must have a stopband or a beta") if stopband_db.nil? && beta.nil? super(size: size) size = @size @equation = lambda { |n| } calculate @values = @values.take(@size) end |
Instance Method Details
#beta_for_db(db) ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/strategies/window/kaiser_window.rb', line 18 def beta_for_db(db) if db <= 21 return 0 elsif db < 50 return 0.5842*((db - 21) ** 0.4) + 0.07886 * (db - 21) else return 0.1102*(db - 8.7) end end |