I have to subtract, from a signal x[n], its version filtered thorugh an LPF FIR filter, like this:


How can I remove the group delay introduced by the filter h_lpf into the signal xf?

I know it is equal to $\tau_{grp}=\frac{N-1}{2}$, where N is the number of taps.

In my case N is odd, so $\tau_{grp}$ is an integer.

In this page:


in the section (Compensating for Delay Introduced by Filtering) there's a method, which I here adapt for my case: (note: "x" is the input signal, and D is the group delay):

xf = filter(h_lpf,1,[x zeros(1,D)]);      % Append D zeros to the input data
xf = xf(D+1:end);                         % Shift data to compensate for delay
Could anyone explain it to me? Could I use it for my problem?

  • $\begingroup$ I agree with the answer by second floor expert. What if the filter has a non-linear phase response? From my experienment in simulink/matlab, the group delay is calculated as zero instead between input and output, do you know why is that? $\endgroup$ – SignalPeter Oct 19 '18 at 14:35

If the low pass filter has a linear phase response, then the group delay it introduces is indeed constant, and it equals $\tau_g=(N-1)/2$ samples, with $N$ being the number of taps. If $N$ is odd, then the group delay is an integer number of samples, and in this case you just have to shift the output signal $\tau_g$ samples to the left as compared to the original signal:

$$y[n]=x[n]-x_f[n+\tau],\quad \tau\in\mathbb{N}$$

This is exactly what the Matlab code in your question does. Don't forget to make sure that the number of filter taps $N$ is odd!

Alternatively, you could delay the original signal $x[n]$ by the filter's group delay before subtracting from it the filtered signal.


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.