I applied the following FIR comb filter in real-time:
y[n]=x[n]-x[n-40]
Since this is an FIR, the group delay is D=(N-1)/2=20 samples. After applying the filter to a signal, I tried to use cross correlation between the filtered and unfiltered signal, to reproduce D computationally by determining the argmax of the cross correlation (I do have a need to the delay this way). The issue is that I get too peaks in the cross correlation, one at zero lag and another at 20 lag. But the peak at zero lag is the maxima which means the peak at 20 lag which is the correct lag is ignored. This method work really well with other filters like averaging filters.
Does anyone know while I get a the peak at zero which is overshadowing the real peak? Is this normal for comb filters? Is there another method to compute delays using the filtered and unfiltered signal other than cross correlation?
Answer
Since this is an FIR, the group delay is D=(N-1)/2=20 samples.
No, since this is a linear phase (i.e. symmetric or anti-symmetric) filter, the group delay is half the length! (being a FIR isn't sufficient.)
The issue is that I get too peaks in the cross correlation, one at zero lag and another at 20 lag.
Write down the formula for auto-correlation at zero lag. Compare that to the formula of "energy of a signal". They are identical!
This really shouldn't surprise you!
This method work really well with other filters like averaging filters.
This method works with anything that has a non-zero zero-lag coefficient.
Does anyone know while I get a the peak at zero which is overshadowing the real peak?
Yes, because autocorrelation at zero is simply the energy. And since correlation is a linear, and your system passes through the original signal, plus a delayed version of it, you get the sum of the auto-correlation of the input signal and the cross-correlation of your delayed signal and the input signal.
The 20-lag peak is no "realer" than the 0-lag peak.
Is this normal for comb filters?
This is normal for any linear time-invariant system.
Is there another method to compute delays using the filtered and unfiltered signal other than cross correlation?
The group delay is really defined as derivative of the phase of your signal over frequency. If in doubt, estimate the spectrum of your system, and derive its phase. You'll notice that only a few specific systems (linear-phase, see above) have constant group delay.
Hence, I'm not sure your cross-correlation had much to do with group delay to begin with.
No comments:
Post a Comment