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

Low Pass Filter. More...

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

Go to the source code of this file.

Data Structures

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

Macros

#define A_LPF_1(alpha)
#define A_LPF_2(fc, ts)
#define A_LPF_GEN(fc, ts)

Typedefs

typedef struct a_lpf a_lpf
 instance structure for Low Pass Filter
typedef struct a_lpf a::lpf

Functions

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

Detailed Description

Low Pass Filter.

low frequencies are passed, high frequencies are attenuated.

\[ RC\frac{\text{d}V_{\mathrm o}}{\text{dt}}+V_{\mathrm o}=V_{\mathrm i} \]

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

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

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

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

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