I am attempting to effectively high-pass a signal sampled in real time at 10kHz, to remove frequency components <= 1 Hz with minimal distortion (due to phase/group delay) of the signal components >= 20Hz. An ideal filter would be one that gives me the results the filtfilt function does in MATLAB but in real time (it introduces no phase delay, but the signal over the entire time horizon of interest must be available, limiting it's use to offline scanrio). I have tried working with discrete time high-pass filter, but in the case if IIR filters there is too much distortion, while in the case of FIR the phase delays are too large and I find that the filtered signal "lags" way too much for it to be useful. I have also looked into methods for smoothing out the sampled signal, the idea being that I will then remove the smoothed out signal from my original to have only the higher frequency components intact. I haven't found anything that works well while being computationally inexpensive.

I am implementing this filter on an 80MHz micro-controller, which means that theoretically my computational limit is 8000 computations every sample period, but in reality, with other processes occurring on the controller, it is closer to ~500 computations.

If anybody is experienced with real time filter implementation that introduces low phase delays, please grant me some of your wisdom and point me in the right direction!


Edit, filter specs: in terms of filter specs, I would like 40dB attenuation <1Hz, and < 0.1dB ripple in the pass band, >20 Hz. I would like <0.1 rad phase deviation in the pass band.

Edit, signal type: the signal component that is <1Hz is highly predictable visually, but I've been having trouble applying tools such as machine learning based models to predict it. I don't think I have enough samples to make a robust model.

Edit, some additional thoughts. I believe the solution I am looking for is based on prediction/extrapolation. I don't think this problem can simply be solved by a well designed linear filter. Some online form of learning of the disturbance signal must be developed, and I am open to suggestions on this topic.

  • 2
    $\begingroup$ I'm having a hard time translating your problem description to a filter specification that can be traded off. $\endgroup$ – Stanley Pawlukiewicz May 18 at 0:28
  • $\begingroup$ Your requirement may be impossible unless your signal is highly predictable. Generally there are trade-offs between delay, phase distortion, and filter transition width, etc. They can’t all be zero. So specify some non-zero constraints. $\endgroup$ – hotpaw2 May 18 at 0:50
  • $\begingroup$ I think you can use a Chebyshev IIR filter here, but I'm having a hard time understanding your specification so I cant suggest whether class 1 or 2, or even elliptic would suit. just remember to check for stability. $\endgroup$ – Thefoilist May 18 at 1:10
  • $\begingroup$ Thanks for your suggestions, I've made a few constraint specifications. $\endgroup$ – Roman Grigorii May 18 at 1:24
  • $\begingroup$ a very simple second order IIR DC blocking notch can be used. But it will definetely have nonlinear phase and group delay distortion therefore ? try it and see if the distortion due to group delay is acceptable... $\endgroup$ – Fat32 May 18 at 22:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.