ya kno it

Dependencies:   Filters

Revision:
2:02d31a0caac1
Parent:
0:850bf2d90868
Child:
3:cd11e6e02817
--- a/emg.cpp	Wed Oct 25 12:36:04 2017 +0000
+++ b/emg.cpp	Fri Oct 27 12:49:11 2017 +0000
@@ -2,7 +2,9 @@
 
 emg_shield::emg_shield(PinName pin,float fs):emg_in(pin)
 {
-    highpass.a=0.05;                                // filter coefficient of high-pass filter
+    float Ts = 1/fs;
+    float fc = 9.0;  
+    highpass.a= 1/(2*3.1415*Ts*fc +1);                                // filter coefficient of high-pass filter
     float lambda= 51.6    *2.0*3.1415;                    // 50 Hz notch filter frequency in rad/s (Hz*2*pi)
     float b= 4.0          *2.0*3.1415;                    // 50 Hz notch filter bandwidth in rad/s (Hz*2*pi)
     notch50.lambda = lambda/(2.0*fs);               // scaling for the 2/T multiplication which happens in the transform from s-domain to z-domain
@@ -11,7 +13,7 @@
     float b2= 4.0         *2.0*3.1415;                    // 100 Hz notch filter frequency in rad/s (Hz*2*pi)
     notch100.lambda = lambda2/(2.0*fs);             // scaling for the 2/T multiplication which happens in the transform from s-domain to z-domain
     notch100.b = b2   /(2.0*fs);                    // scaling for the 2/T multiplication which happens in the transform from s-domain to z-domain
-    float wc = 10        *2.0*3.1415;                    // butterworth filter cutoff frequency in rad/s (Hz*2*pi)
+    float wc = 5.0        *2.0*3.1415;                    // butterworth filter cutoff frequency in rad/s (Hz*2*pi)
     butter.w = wc/(2.0f*fs);     
     Value=0;
     butter.yprev[0]=0;