??? 12/09/06 13:47 Read: times |
#129210 - how this removes DC offset? Responding to: ???'s previous message |
I cant understand how do You plane to remove
DC offset. Sdditionally some notes: 1. //y[n] =(0.996 * y[n-1]) + (0.996 * x[n]) - (0.996 * x[n-1]) I'm missing something or //y[n] =(0.996 * y[n-1]) + (0.996 * x[n]) - (0.996 * x[n-1]) === ==== 0.996 *(y[n-1]+x[n]-x[n-1]) Anyway this cannot be correct - check that appnote - filter has different coefficientsfor different members of expression: y[n]=a.y[n-1]+b.x[n]+c.x[n-1]. For example: http://www-users.cs.york.ac.uk/~fisher/mkfilter high pass filter, sample rate 50hz, stop freq=10hz: /* Digital filter designed by mkfilter/mkshape/gencode A.J. Fisher Command line: /www/usr/fisher/helpers/mkfilter -Be -Hp -o 2 -a 2.0000000000e-02 0.0000000000e+00 -l */ #define NZEROS 2 #define NPOLES 2 #define GAIN 1.088114353e+00 static float xv[NZEROS+1], yv[NPOLES+1]; static void filterloop() { for (;;) { xv[0] = xv[1]; xv[1] = xv[2]; xv[2] = next input value / GAIN; yv[0] = yv[1]; yv[1] = yv[2]; yv[2] = (xv[0] + xv[2]) - 2 * xv[1] + ( -0.8425385784 * yv[0]) + ( 1.8335456400 * yv[1]); next output value = yv[2]; } } 2.Your filter is something like low (or high?) pass filter How this helps to eliminate DC offset? 3.As Russel says "outputting 50 values a second is overkill" 4.From where You get these 200 microseconds period for sampling? 5.There are much better micros for poweremeter, specialized too. regards, Stefen |
Topic | Author | Date |
filter for DC offset removal | 01/01/70 00:00 | |
I think its already done | 01/01/70 00:00 | |
Some hints | 01/01/70 00:00 | |
confusion.. | 01/01/70 00:00 | |
Do you need real time? | 01/01/70 00:00 | |
how this removes DC offset?![]() | 01/01/70 00:00 |