# Truncating the output of a digital filter. Which part to discard?

Suppose I have a signal $$\mathbf{x}\in \mathbb{C}^{N}$$ and a digital filter with impulse response $$\mathbf{h}\in\mathbb{C}^L$$, where $$L. If we pass the signal through the filter, the output will be $$\mathbf{y}\in\mathbb{C}^{N+L-1}$$. My question is: if I want to truncate the output vector to be the same length as $$\mathbf{x}$$, which elements should I discard? The first $$L$$? and why?

• What are you trying to do? Overlap-add (OLA) or Overlap-save (OLS) convolution? If you're doing OLS by use of the FFT, which does circular convolution, then it's the first $L-1$ samples that are discarded. But if you're doing OLA, the first $L-1$ samples are overlapped with the last $L-1$ samples of the previous frame and those overlapped samples are added. Commented Nov 9, 2023 at 11:40
• @robertbristow-johnson I have a received signal that I pass through a receive filter. I need the output to be the same length as the input signal to do the detection and decoding. Commented Nov 9, 2023 at 12:21

Truncation will also will always result in an error. Which truncation schemes is best depends on the specific filter, your signal and what classes of error your application is more or less sensitive to.

As a rough rule of thumb for a minimum phase filter you most likely want to truncate the end, for a linear phase filter you may want to split it 50/50 between the beginning and the end for a channel equalizer it really depends on how the equalizer was designed.

The more or less assumed canonical signal is $$\mathbf x \in \mathbb C^\infty$$, i.e. there are $$x_n\ \forall\ n \in (-\infty, \infty)$$.

For your situation, there is no one "best" -- each individual problem will have its own optimal solution, and exactly what makes it optimal may not be immediately obvious to the system designer*.

For any filtering problem, the optimal filter is the one that filters out what you don't want, and leaves in what you do want. For your case, you need to find the filter that does that within the constraints that you have -- but again, it depends on your problem.

I hesitate somewhat to say this, because you seem to be seeking a general rule where there is none, so don't quote me on this:

First, it is often -- but most certainly not always -- the case that if $$\mathbf h$$ is symmetrical around some center point**, then you want to keep the $$N$$-element long subset of $$\mathbf y$$ that is in the center, i.e. discard the first and last segments of length $$\frac L 2$$.

Second, it is often -- but certainly not always -- that if you're using a minimum phase filter*** then you want to keep the first $$N$$ outputs from the filter.

But -- always -- it is best to design your filter and the output samples that you retain to best solve your problem at hand.

* And, indeed, what is "best" may be a subject of debate among the system designers.

** I.e., it is linear phase

*** I.e., an IIR filter with all of its zeros inside the stability region, or an FIR filter that simulates that condition