Class: Dsp::Systems::RaisedCosineFilter
- Inherits:
-
System
- Object
- System
- Dsp::Systems::RaisedCosineFilter
- Defined in:
- lib/systems/raised_cosine_filter.rb
Instance Method Summary collapse
-
#initialize(tb:, beta:, sample_rate:, size:) ⇒ RaisedCosineFilter
constructor
A new instance of RaisedCosineFilter.
Constructor Details
#initialize(tb:, beta:, sample_rate:, size:) ⇒ RaisedCosineFilter
Returns a new instance of RaisedCosineFilter.
4 5 6 7 8 9 |
# File 'lib/systems/raised_cosine_filter.rb', line 4 def initialize(tb: ,beta: ,sample_rate: ,size: ) @eqn = ->(t, tb, beta){ (tb / (2 * beta.to_f) or (-tb / (2 * beta.to_f))) ? Math::PI * Dsp::Functions.sinc(1.0 / (2 * beta)) / (4.0 * tb) : (1 / tb.to_f) * Dsp::Functions.sinc(t / tb.to_f) * Math.cos((Math::PI * beta * t) / tb.to_f) / (1 - ((2*beta*t) / tb.to_f) ** 2)} # super(eqn: @eqn, sample_rate: sample_rate, size: size) data = Dsp::AnalogSignal.new(eqn: @eqn, sample_rate: sample_rate, size: size).digitize super(data) end |