# What happens if you apply window after filtering a discrete signal to get it back to its original length?

What happens if you filter a discrete bandpass signal of length $N$ with a bandpass filter(Hann truncated sinc) of length $L$ and apply a window of length $N$ to the filtered signal of length $N+L-1$ to get back the signal to its original length $N$?

• Your question has beeen answered. Do not hesitate to vote for the useful ones and accept the most suitable – Laurent Duval Feb 9 '17 at 17:26
• Answer upvotes and better answer validation are required for this question – Laurent Duval Jul 28 '19 at 14:27

If you want the output signal to have the same length as the input signal you would usually disregard the last $L-1$ samples of the result of the convolution. In Matlab/Octave, you could just use the function filter instead of conv. This will compute one output sample for each input sample, and, consequently, the output signal will have the same length as the input signal.
You cannot "really" apply a window whose length is different from the size of the signal, since it resorts to a sample-wise product. However, you can for instance apply a composite window, made of a standard window $w$ for the first $N$ samples, and filled with zeros for the remaining samples (to the right). If $w$ is a rectangular window, you get with conv.m what you would have with filter.m, plus the flat tail, as explained by @MattL; the red lines (filter.m) and blue crosses (conv.m) are matching perfectly: Of course, you could use a non-rectangular window (here the Hann), and you get a nicer apodization at the edges (the signal is flattened to $0$), but you could as well window the output of filter.m