I sample a signal at a certain frequency for a finite amount of time to get a sequence $$(x\_n)\_{n=1}^N = (x\_1, x\_2, ... , x\_N)$$

with the intention of analyzing its power spectral density by calculating its DFT.

I decide that the tail end of the sequence shouldn't be analyzed (that is, I want to discard all $x\_n$ for $n\gt a$ for some $a\leq N$), but I want the DFT to have the same number of samples (in this case, $N$ samples).

One approach would be to truncate the sequence at $x\_a$, remove the mean, apply a Hamming window to this truncated sequence, pad the truncated sequence with $N-a$ zeroes, and then calculate its DFT.

**Question:** Let's say that the section I don't want to analyze is an interval in the *middle* of the sequence. How do I calculate the DFT of this and make sure the DFT has $N$ samples? Should I remove the mean, apply *two* Hamming windows (one each on each section I don't want to discard), set the elements in the middle that I want to discard to zero, and calculate the DFT?

This is related to my other question [here](https://math.stackexchange.com/questions/1853356/dft-of-a-sequence-while-ignoring-some-of-its-elements).