I need to high pass filter a signal, and my design just isn't cutting it. The part that's making it tricky is that I can't tolerate lag. I am sampling at 20Hz, the signal I care about is 1/12 to 1/4Hz, and my system has to be as real time as possible (a lag of 2 seconds for signal processing is about all I can handle). The corner frequency is flexible, but has to be below 1/10Hz worst case.
I have been using an IIR-like lowpass filter like this:
signal_low_freq(n) = (signal_low_freq(n-1)*(filter_constant - 1) + (sensor_data(n))) /filter_constant; signal_ac(n) = sensor_data(n) - signal_low_freq(n);
where filter_constant = 165.
It has low latency, but also introduces a large amount of phase related error (I measured it at about 100 samples of lag).
I have used Matlab's fdatool, and can get great results with a high order FIR filter, but that's obviously far too much lag.
Does anybody have a good solution to this DSP problem?
As a note: in the audio range, it's analogous to sampling at 48kHz and high-pass filtering with a corner frequency somewhere between 150Hz and 240Hz.