Filtre passe bas simple

Committer:
garivetm
Date:
Wed Feb 17 10:13:07 2016 +0000
Revision:
3:79a6e3d33887
Parent:
2:46a658fe2f70
Bug correction in filtre formula

Who changed what in which revision?

UserRevisionLine numberNew contents of line
garivetm 0:a5c9e3376d19 1 #include "FiltrePB.h"
garivetm 0:a5c9e3376d19 2
garivetm 1:999ae031e7c1 3 FiltrePB::FiltrePB(){
garivetm 0:a5c9e3376d19 4 }
garivetm 0:a5c9e3376d19 5
garivetm 2:46a658fe2f70 6 FiltrePB::FiltrePB(float fc, float Ts) : Ts_m(Ts), fc_m(fc){
garivetm 2:46a658fe2f70 7 vep_m=vsp_m=vs_m=0.0;
garivetm 2:46a658fe2f70 8 tau_m=1.0/(fc_m*2*3.1415); //calcul de la constante de temps
garivetm 2:46a658fe2f70 9 a_m=1.0/(1+(2*tau_m/Ts_m)); //calcul du coefficient a du filtre
garivetm 3:79a6e3d33887 10 b_m=(1.0-(2*tau_m/Ts_m))*a_m; //calcul du coefficient b du filtre
garivetm 1:999ae031e7c1 11 }
garivetm 1:999ae031e7c1 12
garivetm 2:46a658fe2f70 13 float FiltrePB::compute(float ve){
garivetm 3:79a6e3d33887 14 vs_m=a_m*ve+a_m*vep_m-b_m*vsp_m;
garivetm 2:46a658fe2f70 15 vep_m=ve;
garivetm 2:46a658fe2f70 16 vsp_m=vs_m;
garivetm 2:46a658fe2f70 17 return vs_m;
garivetm 0:a5c9e3376d19 18 }
garivetm 0:a5c9e3376d19 19