A simple biquad filter
Dependents: emgfilter includeair includeair Encodertest ... more
Biquad.cpp@2:3a80d1f8f30a, 2015-10-29 (annotated)
- Committer:
- Gerth
- Date:
- Thu Oct 29 14:03:02 2015 +0000
- Revision:
- 2:3a80d1f8f30a
- Parent:
- 0:ba910c57d594
converted floats to doubles
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Gerth | 0:ba910c57d594 | 1 | #include "Biquad.h" |
Gerth | 0:ba910c57d594 | 2 | |
Gerth | 0:ba910c57d594 | 3 | Biquad::Biquad(){}; |
Gerth | 0:ba910c57d594 | 4 | |
Gerth | 0:ba910c57d594 | 5 | double Biquad::filter( double u, double &v1, double &v2, const double a1, const double a2, |
Gerth | 0:ba910c57d594 | 6 | const double b0, const double b1, const double b2 ) |
Gerth | 0:ba910c57d594 | 7 | { |
Gerth | 0:ba910c57d594 | 8 | double v = u - a1*v1 - a2*v2; |
Gerth | 0:ba910c57d594 | 9 | double y = b0*v + b1*v1 + b2*v2; |
Gerth | 0:ba910c57d594 | 10 | v2 = v1; |
Gerth | 0:ba910c57d594 | 11 | v1 = v; |
Gerth | 0:ba910c57d594 | 12 | return y; |
Gerth | 0:ba910c57d594 | 13 | } |