EMG_filter zonder moving average

Dependencies:   HIDScope mbed

Fork of EMG by Kevin Hetterscheid

Revision:
19:105e719a8aa5
Parent:
18:e753220c7ba6
Child:
20:75600951afdf
--- a/main.cpp	Mon Oct 19 11:44:19 2015 +0000
+++ b/main.cpp	Tue Oct 20 09:17:43 2015 +0000
@@ -28,7 +28,6 @@
     prev_outputs[0] = new_input;
     return new_output;
 }
-
 double fh_b[]= {0.7602, -3.0406, 4.5609, -3.0406, 0.7602};
 double fh_a[]= {1, -3.4532, 4.5041, -2.6273, 0.5778};
 double highpass_filter(double u)
@@ -36,8 +35,8 @@
     return filter(u, fh_a, fh_b, highV);
 }
 
-double fl_b[]= {0.00000658, 0.00002631, 0.00003947, 0.00002631, 0.00000658};
-double fl_a[]= {1.0000, -3.7264, 5.2160, -3.2500, 0.7605};
+double fl_b[]= {0.00001329,    0.00005317,    0.00007976,   0.00005317,    0.00001329};
+double fl_a[]= {1.0000,   -3.6717,    5.0680,   -3.1160,    0.7199};
 double lowpass_filter(double u)
 {
     return filter(u, fl_a, fl_b, lowV);
@@ -53,13 +52,13 @@
     double output2 = fabs(output1);
     double output3 = lowpass_filter(output2);
     
-    double tot = output3;
+    /*double tot = output3;
     for(int i=0; i<MOV_AVG_NUM-1; i++) {
         tot += lastOutputs[i];
         if(i != 0) lastOutputs[i] = lastOutputs[i-1];
     }
     lastOutputs[0] = output3;
-    output3 = tot/MOV_AVG_NUM;
+    output3 = tot/MOV_AVG_NUM;*/
     
     /* Second, set the sampled emg value in channel zero (the first channel) in the 'HIDScope' variable named 'scope' */
     scope.set(0,input);