EMG filter. Waarden nog niet perfekt.

Dependencies:   HIDScope mbed

Committer:
janwillembisschop
Date:
Fri Oct 28 08:55:20 2016 +0000
Revision:
1:70dc835f3a37
Parent:
0:2956e3501f8a
EMG filter met goede waarden

Who changed what in which revision?

UserRevisionLine numberNew contents of line
janwillembisschop 0:2956e3501f8a 1 #include "Filter.h"
janwillembisschop 0:2956e3501f8a 2
janwillembisschop 0:2956e3501f8a 3 double Filter(double u, double &v1, double &v2, const double a1, const double a2, const double b0, const double b1, const double b2, const double gain)
janwillembisschop 0:2956e3501f8a 4 {
janwillembisschop 0:2956e3501f8a 5
janwillembisschop 0:2956e3501f8a 6 double v = u - a1*v1 - a2*v2;
janwillembisschop 0:2956e3501f8a 7 double y = gain * (b0*v + b1*v1 + b2*v2);
janwillembisschop 0:2956e3501f8a 8
janwillembisschop 0:2956e3501f8a 9 v2 = v1;
janwillembisschop 0:2956e3501f8a 10 v1 = v;
janwillembisschop 0:2956e3501f8a 11
janwillembisschop 0:2956e3501f8a 12 return y;
janwillembisschop 0:2956e3501f8a 13
janwillembisschop 0:2956e3501f8a 14 }