# Effect of changing sample rate, window duration and zero padding on DTFT and DFT

Let $$T$$ be the window duration, $$N$$ be the DFT size, $$F_s$$ be the sample rate, and $$F_{max}$$ be the frequency of the highest bin. In the context of image below:

• halving the $$F_s$$ (keeping $$T$$ constant and N constant halving N) would remove the right half of the bins (halving the maximum frequency)
• halving $$T$$ would change the shape of the DTFT, halving the number of lobes. Without zero padding this would halve $$N$$, but $$F_{max}$$ would remain constant and so every second bin would be removed.
• doubling $$N$$ by zero padding the DFT would keep the DTFT and $$F_{max}$$ constant but would double the number of bins (i.e. interpolation of the DTFT).

Is my understanding sound?

Edit: No. I had overlooked aliasing when halving $$F_s$$

The question will be improved by including units. I assume $$T$$ is in seconds, and $$F_s$$ is in Hz, while $$N$$ is the number of bins in the DFT. To avoid any confusion to anyone else, but perhaps more obvious, "bins" will refer to samples in the frequency domain and "samples" will refer to samples in the time domain.

halving the Fs (keeping T and N constant) would remove the right half of the bins (halving the maximum frequency)

Almost. Assuming $$T$$ is a duration in units of seconds of the window, then we could then halve the sampling rate and only keep $$N$$ and $$T$$ constant if we then zero-pad the new result. See the response to the OP's third question at the bottom with specifics to the effect of zero-padding, then consider the zero padded spectrum which is then resampled as follows.

In either case (zero padding or not), in general, by halving the sampling rate, we are RESAMPLING in time to a new sampling rate half as much by selecting every other sample in time. This is no different than sampling an analog spectrum in that we can get aliasing if there is spectrum in the image frequency locations.

This is depicted in the graphic below, showing the inherent periodicity in the DFT spectrum, if we could extend the frequency axis beyond the 0 to N-1 samples. This is indeed how the spectrum of a sampled signal appears, notably that the spectrum that is centered around $$F=0$$ repeats identically at every multiple of the sampling rate $$F_s$$ (and therefore we only need to display the spectrum from $$-F_s/2$$ to $$+F_s/2$$ or alternatively as in the DFT from $$0$$ to (one bin less than) $$F_s$$. So when we RESAMPLE the digital signal, we don't change the spectrum as it started, but we add images of that same spectrum centered on every new sampling frequency location in the frequency domain.

One might be tempted to say along the lines of where the OP was heading that when we cut the sampling rate in half we remove half the spectrum- not the upper half of the DFT as was suggested by the OP, but certainly as we see below the middle portion can be described as having been removed. This is not entirely true, and only appears as such if there was no spectral content previously in that middle section. Certainly in the plot immediately below the spectrum is clean so a "removal" description would apply, but simply widen the spectral shapes below and we see how they soon collide into each other after we resample (asliasing!), so in general it should NOT be thought of that way.

In summary, removing every other sample in time (down-samping), causes the sampling frequency to move down half as much, and carries all the original spectrum with it that was centered at every multiple of $$F_s$$ is now centered at every multiple of the new sampling rate. The N samples in the DFT now occupy the spectrum from $$0$$ to $$F_s^{'}$$.

halving T would change the shape of the DTFT, halving the number of lobes. Without zero padding this would halve N, but Fmax would remain constant and so every second bin would be removed.

This then means $$F_s$$ must be in units of samples/sec. (Often with the DFT we use units of cycles/sample so want to clarify this). In this case then yes, without any zero-padding all $$N$$ samples are over $$T$$, so $$F_s$$ is $$N$$ samples over $$T$$ seconds. Similar to the frequency domain relationship above, as long as the cyclical time window can be equivalent before and after removing the samples, then indeed the only change in frequency will be that every other bin will be removed. Otherwise to maintain the same exact spectrum values for all the bins that remain, we would need to have the equivalent of time domain aliasing, or otherwise we must have aliasing is frequency. The easiest way to see this is to consider 2 cycles in time of a sine wave- this we could cut in half and still have the exact same spectrum, every other bin. Now consider one cycle of a sine wave: We can't cut this in half and expect to see the same spectrum- it will be aliased, or we would need to have a modified time domain that is aliased.

doubling N by zero padding the DFT would keep the DTFT and Fmax constant but would double the number of bins

Zero padding will keep the original samples of the DFT at the same value (but moved to new bin locations since there are more samples overall). This will specifically interpolate new samples in between all the original samples. These samples will be on the DTFT. The more zeros you add, the more samples from the DTFT appear in between the original samples which were also on the DTFT so they don't change. The DTFT is when N goes to $$\pm \infty$$. Any DFT is samples on the DTFT, and zero padding reveals more of these samples.

• Thanks! I had overlooked aliasing/didn't know what it was. Thanks for catching that! – Tom Huntington Apr 16 '20 at 1:59
• That was the utility of that background I showed you on the "unrolled" digital spectrum- but I know exactly what you mean as you would think the middle portion can just be sliced out otherwise. The stamping in the same spectrum at the sampling frequency appears to be more universally applicable. – Dan Boschen Apr 16 '20 at 2:04
• I actual thought that the frequencies on the end would just disappear/be sliced off. But they actually come back. – Tom Huntington Apr 16 '20 at 2:07
• The way I teach it I suggest that I can actually punch through this wall (on one side of the room) and you would see my fist come through on the other side. This also explains the poor misconception with "spectrum folding". It doesn't fold! It rolls around to the negative frequencies. If you only deal with real signals it appears instead to "fold" but that is really misleading and a hard thing to overcome when coming over to the complex world. – Dan Boschen Apr 16 '20 at 2:10

halving the $$F_s$$ (keeping $$T$$ and $$N$$ constant) would remove the right half of the bins (halving the maximum frequency)

No. Number of bins remain same because you have not changed $$N$$. What will change is the resolution. Each bin will represent $$F_s/(2N)$$ instead of $$F_s/N$$. Your DFT will not represent analog frequencies from $$F_s/2$$ to $$F_s$$ That is why you misunderstood as 'remove right half of the bins'.

halving $$T$$ would change the shape of the DTFT, halving the number of lobes. Without zero padding this would halve $$N$$, but $$F_{max}$$ would remain constant and so every second bin would be removed

I am assuming that when you halve $$T$$, you are also reducing DFT to $$N/2$$. If you reduce FFT size with no zero padding, yes, you are dropping every second bin. Because the resolution now increases to $$F_s/(N/2)$$. For a period signal, with $$N/2$$ multiple of period, you will still see only 2 peaks for the FFT because the lobe width also has doubled, and the zero crossing appear exactly at multiples of $$F_s/(N/2)=2 F_s/N$$.

doubling N by zero padding the DFT would keep the DTFT and Fmax constant but would double the number of bins

Yes, zero padding would increase the resolution of DFT. $$F_s/(2N)$$ is the resolution as compared to earlier $$F_s/N$$. But remember by zero padding you are not adding any new information about the signal. It just reveals more of the DFT you already have.

• Thanks! for catching that. I was thinking halving $F_s$ and thus keeping $T$ constant, which must mean that $N$ halves if window size equals DFT size. But I forgot that when writing. – Tom Huntington Apr 15 '20 at 6:05