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

Data Structures

struct  a_hpf
 instance structure for High Pass Filter More...
 

Macros

#define A_HPF_INIT(alpha)
 
#define A_HPF_INIT2(fc, ts)
 
#define A_HPF_GEN(fc, ts)
 

Typedefs

typedef struct a_hpf a_hpf
 instance structure for High Pass Filter
 

Functions

double a_hpf_gen (double fc, double ts)
 generate for High Pass Filter
 
void a_hpf_init (a_hpf *ctx, double alpha)
 initialize for High Pass Filter
 
double a_hpf_iter (a_hpf *ctx, double x)
 calculate for High Pass Filter
 
void a_hpf_zero (a_hpf *ctx)
 zeroing for High Pass Filter
 

Detailed Description

Macro Definition Documentation

◆ A_HPF_GEN

#define A_HPF_GEN ( fc,
ts )
Value:
(1 / (A_FLOAT_TAU * a_float_c(fc) * a_float_c(ts) + 1))
#define a_float_c(x)
Definition a.h:782
#define A_FLOAT_TAU
Definition math.h:239

◆ A_HPF_INIT

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

◆ A_HPF_INIT2

#define A_HPF_INIT2 ( fc,
ts )
Value:
{A_HPF_GEN(fc, ts), 0, 0}

Function Documentation

◆ a_hpf_gen()

double a_hpf_gen ( double fc,
double ts )

generate for High Pass Filter

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

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

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

◆ a_hpf_init()

void a_hpf_init ( a_hpf * ctx,
double alpha )

initialize for High Pass Filter

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

◆ a_hpf_iter()

double a_hpf_iter ( a_hpf * ctx,
double x )

calculate for High Pass Filter

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

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

◆ a_hpf_zero()

void a_hpf_zero ( a_hpf * ctx)

zeroing for High Pass Filter

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