2
$\begingroup$

Do all real-time filters introduce phase lag? I once heard of "lagless filters", but I don't think they can be used real-time (ie: on live data streaming in for a control system, for example, operating on incoming data), correct?

Obviously even though this question could be simply answered in a binary "yes/no" fashion, expounding upon the answer will be very helpful.

Update:

I just added some links in the comments below this question.

Also, here's some brief comments from a couple controls experts I know:

Kenny Jensen: "Forward-backward filters, aka smoothers, have no lag. You can't run them online though."

Ed Lim: "Hence they are not "real-time" filters. So I believe the answer is yes regarding real-time filters."

$\endgroup$
  • $\begingroup$ Related or close-to-duplicate question that might be useful. $\endgroup$ – Peter K. Feb 22 '18 at 21:30
  • 1
    $\begingroup$ You'd think they'd have to, if they can't reach into the past or look into the future. Imagine an LPF with a 3-sample memory buffer over a triangle wave. It can see there was a peak in the previous 3 samples, but it can only filter it by smoothing it out afterwards. I think operating in the present based on data from the past is always going to introduce that lag. At least this should hold if "real-time filters" means they only set $y[n]$ at each step and not $y[n-1]$, etc. $\endgroup$ – Guest Feb 23 '18 at 1:43
  • $\begingroup$ Besides what @Guest said, even analog filters have reactive components that either perform the integral or the derivative of the applied signal, which means they depend on a temporal behaviour, as opposed to an ideal, single point, for ideal resistors (for example), which means an inherent delay. $\endgroup$ – a concerned citizen Feb 23 '18 at 8:01
  • $\begingroup$ The answer is yes, simply because all physical devices require time for a signal to propagate through them. Even a 1 mm long wire will introduce phase shift to a signal. $\endgroup$ – user5108_Dan Mar 1 '18 at 16:11
  • $\begingroup$ So zero-lag filters such as the one mentioned here can only be achieved via post-processing? Or what does "zero lag" or "lagless" filter really mean? dsp.stackexchange.com/a/26300/18242 $\endgroup$ – Gabriel Staples Mar 1 '18 at 21:45
1
$\begingroup$

If a filter has any memory and that memory affects the current output, then that past data is lagged into the present. If that filter is time invariant, then a memory of the present can potentially affect future output. e.g. is lagged into the future. So, yes, unless the filter is memoryless or not time invariant.

Note that a unit impulse at the origin is memoryless, but impossible to implement in any finite size system due to the speed of light being finite.

$\endgroup$
  • $\begingroup$ This paper shows some filters with zero phase lag: health.uottawa.ca/biomech/lab/docs/ncb2_gr.pdf. Maybe you can expound upon your answer in the context of this paper and this answer? dsp.stackexchange.com/questions/26299/… $\endgroup$ – Gabriel Staples Mar 1 '18 at 21:48
  • $\begingroup$ Real time ( term as asked) is most often assumed to be causal. The paper covers the case where the filter is applied in both directions in time as in processing recorded data or by something called a fixed lag filter where extra delay can be used for the time reverse pass. The combination of fixed lag and zero lag, is a fixed lag, but also a nearly linear phase (dispersion-less) response $\endgroup$ – Stanley Pawlukiewicz Mar 2 '18 at 4:12
1
$\begingroup$

Consider the frequency response of a generic LTI system, written in split magnitude-phase form:

$$\begin{align} H(f) &= \Big|H(f)\Big| \, e^{j\arg\{H(f)\}} \\ \\ &= A(f) \, e^{j\phi(f)} \\ \end{align}$$

where

$$\begin{align} A(f) &\triangleq \Big|H(f)\Big| \\ \\ \phi(f) &\triangleq \arg\{H(f)\} \\ \end{align}$$

$A(f) \ge 0$ represents the magnitude response of the system and $\phi(f)$ is its phase response. Now, assume that the system has zero phase lag at all frequencies. That is, $\phi(f) = 0$. Its frequency response is then just:

$$ H(f) = A(f) $$

We observe from this that the system has a frequency response that is real-valued (and nonnegative, but that's not relevant here).

Now, recall the Hermitian symmetry property of the Fourier transform:

If a frequency-domain signal $H(f)$ is real-valued, then its Fourier transform dual $h(t)$ is Hermitian symmetric. That is: $$h(-t) = h^*(t)$$

So, the signal that you get from taking the inverse Fourier transform of $H(f)$ is Hermitian symmetric. However, remember that the inverse Fourier transform of an LTI system's frequency response is its impulse response. Therefore, this means that the impulse response of the theoretical zero-phase system is Hermitian symmetric.

It follows, then, that if the impulse response $h(t)$ is nonzero for any values of $t > 0$, then it is also nonzero for some values of $t < 0$. There are two potential cases to discuss here:

  1. $h(t)$ is nonzero for some values of $t > 0$. Due to the Hermitian symmetry of the impulse response, it must also be nonzero for corresponding values of $t < 0$. If an LTI system has an impulse response that is nonzero for any $t < 0$, it is noncausal and therefore unrealizable in a real-time implementation.

  2. $h(t) = 0$ for all $t > 0$. In this case, $h(t)$ is either zero for all $t$, or it is an impulse function. Both of these are technically zero-phase, causal filters, so strictly speaking they are realizable. However, they are degenerate cases that aren't very interesting (they just correspond to a constant scaling of the input signal).

So, to summarize, it's not possible to implement a noncausal (and therefore real-time) zero-phase filter with anything but the most trivial magnitude response (a constant).

$\endgroup$
  • $\begingroup$ i think i would change $|A(f)|$ to $A(f)$ to eliminate the superfluous abs value symbol or just call it $|H(f)|$ and eliminate the superfluous $A(f)$ . but it's up to you. $\endgroup$ – robert bristow-johnson Jun 30 '18 at 2:00
  • $\begingroup$ @robertbristow-johnson: Yeah, I went back and forth on it a couple times. I left it in to be explicit that the response is magnitude only. It can't be negative, or that would correspond to a 180-degree phase delay. $\endgroup$ – Jason R Jun 30 '18 at 2:14
  • $\begingroup$ lemme make a change and if you don't like it, change it back. okay? $\endgroup$ – robert bristow-johnson Jun 30 '18 at 2:18
  • $\begingroup$ @robertbristow-johnson Works for me. $\endgroup$ – Jason R Jun 30 '18 at 12:48

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.