liba 0.1.15
An algorithm library based on C/C++
Loading...
Searching...
No Matches
Low Pass Filter
Collaboration diagram for Low Pass Filter:

Data Structures

struct  a_lpf
 instance structure for Low Pass Filter More...
 

Macros

#define A_LPF_INIT(alpha)
 
#define A_LPF_INIT2(fc, ts)
 
#define A_LPF_GEN(fc, ts)
 

Typedefs

typedef struct a_lpf a_lpf
 instance structure for Low Pass Filter
 

Functions

double a_lpf_gen (double fc, double ts)
 generate for Low Pass Filter
 
void a_lpf_init (a_lpf *ctx, double alpha)
 initialize for Low Pass Filter
 
double a_lpf_iter (a_lpf *ctx, double x)
 calculate for Low Pass Filter
 
void a_lpf_zero (a_lpf *ctx)
 zeroing for Low Pass Filter
 

Detailed Description

Macro Definition Documentation

◆ A_LPF_GEN

#define A_LPF_GEN ( fc,
ts )
Value:
#define A_FLOAT_1_TAU
Definition math.h:249
#define a_float_c(x)
Definition a.h:782

◆ A_LPF_INIT

#define A_LPF_INIT ( alpha)
Value:
{a_float_c(alpha), 0}

◆ A_LPF_INIT2

#define A_LPF_INIT2 ( fc,
ts )
Value:
{A_LPF_GEN(fc, ts), 0}

Function Documentation

◆ a_lpf_gen()

double a_lpf_gen ( double fc,
double ts )

generate for Low Pass Filter

\begin{cases} \alpha=\frac{T_s}{RC+T_s},&\alpha\in[0,1]\\ RC=\frac{1}{2\pi f_c}. \end{cases}

\[ \alpha=\frac{T_s}{\frac{1}{2\pi f_c}+T_s} \]

Parameters
[in]fccut-off frequency unit(hz)
[in]tssampling time unit(s)
Returns
filter coefficient [0,1]

◆ a_lpf_init()

void a_lpf_init ( a_lpf * ctx,
double alpha )

initialize for Low Pass Filter

Parameters
[in,out]ctxpoints to an instance of Low Pass Filter
[in]alphafilter coefficient [0,1]

◆ a_lpf_iter()

double a_lpf_iter ( a_lpf * ctx,
double x )

calculate for Low Pass Filter

\[ V_{\mathrm o}(n)=(1-\alpha)V_{\mathrm o}(n-1)+\alpha V_{\mathrm i}(n) \]

Parameters
[in,out]ctxpoints to an instance of Low Pass Filter
[in]xinput value
Returns
output value

◆ a_lpf_zero()

void a_lpf_zero ( a_lpf * ctx)

zeroing for Low Pass Filter

Parameters
[in,out]ctxpoints to an instance of Low Pass Filter