SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
Public Member Functions | Private Attributes | List of all members
LowPassFilterRC Class Reference

#include <filterrc.h>

Public Member Functions

 LowPassFilterRC (Real timeconst)
 
void configure (Real timeout)
 
void process (const Real &sample_in, Real &sample_out)
 

Private Attributes

Real m_timeconst
 
Real m_y1
 
Real m_a1
 
Real m_b0
 

Detailed Description

First order low-pass IIR filter for real-valued signals.

Definition at line 26 of file filterrc.h.

Constructor & Destructor Documentation

◆ LowPassFilterRC()

LowPassFilterRC::LowPassFilterRC ( Real  timeconst)

Construct 1st order low-pass IIR filter.

timeconst :: RC time constant in seconds (1 / (2 * PI * cutoff_freq)

Definition at line 23 of file filterrc.cpp.

References exp(), m_a1, m_b0, and m_timeconst.

23  :
24  m_timeconst(timeconst),
25  m_y1(0)
26 {
27  m_a1 = - exp(-1/m_timeconst);
28  m_b0 = 1 + m_a1;
29 }
Fixed< IntType, IntBits > exp(Fixed< IntType, IntBits > const &x)
Definition: fixed.h:2289
Real m_timeconst
Definition: filterrc.h:46
+ Here is the call graph for this function:

Member Function Documentation

◆ configure()

void LowPassFilterRC::configure ( Real  timeout)

Reconfigure filter with new time constant

Definition at line 32 of file filterrc.cpp.

References exp(), m_a1, m_b0, m_timeconst, and m_y1.

Referenced by BFMDemod::applyAudioSampleRate(), and BFMDemod::BFMDemod().

33 {
34  m_timeconst = timeconst;
35  m_y1 = 0;
36  m_a1 = - exp(-1/m_timeconst);
37  m_b0 = 1 + m_a1;
38 
39  qDebug() << "LowPassFilterRC::configure: t: " << m_timeconst
40  << " a1: " << m_a1
41  << " b0: " << m_b0;
42 }
Fixed< IntType, IntBits > exp(Fixed< IntType, IntBits > const &x)
Definition: fixed.h:2289
Real m_timeconst
Definition: filterrc.h:46
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ process()

void LowPassFilterRC::process ( const Real sample_in,
Real sample_out 
)

Process samples.

Definition at line 45 of file filterrc.cpp.

References m_a1, m_b0, and m_y1.

Referenced by BFMDemod::feed().

46 {
47  /*
48  * Continuous domain:
49  * H(s) = 1 / (1 - s * timeconst)
50  *
51  * Discrete domain:
52  * H(z) = (1 - exp(-1/timeconst)) / (1 - exp(-1/timeconst) / z)
53  */
54 
55  m_y1 = (sample_in * m_b0) - (m_y1 * m_a1);
56  sample_out = m_y1;
57 }
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_a1

Real LowPassFilterRC::m_a1
private

Definition at line 48 of file filterrc.h.

Referenced by configure(), LowPassFilterRC(), and process().

◆ m_b0

Real LowPassFilterRC::m_b0
private

Definition at line 49 of file filterrc.h.

Referenced by configure(), LowPassFilterRC(), and process().

◆ m_timeconst

Real LowPassFilterRC::m_timeconst
private

Definition at line 46 of file filterrc.h.

Referenced by configure(), and LowPassFilterRC().

◆ m_y1

Real LowPassFilterRC::m_y1
private

Definition at line 47 of file filterrc.h.

Referenced by configure(), and process().


The documentation for this class was generated from the following files: