liba 0.1.15
An algorithm library based on C/C++
Loading...
Searching...
No Matches
hpf.h File Reference

High Pass Filter. More...

#include "math.h"
Include dependency graph for hpf.h:

Go to the source code of this file.

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
 
typedef struct a_hpf a::hpf
 

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

High Pass Filter.

high frequencies are passed, low frequencies are attenuated.

\[ RC\frac{\text{d}(V_{\mathrm i}-V_{\mathrm o})}{\text{dt}}=V_{\mathrm o} \]

\[ RC\frac{[V_{\mathrm i}(n)-V_{\mathrm i}(n-1)]-[V_{\mathrm o}(n)-V_{\mathrm o}(n-1)]}{T_s}=V_{\mathrm o}(n) \]

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

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

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

https://en.wikipedia.org/wiki/High-pass_filter