10
$\begingroup$

I'm new to the land of DSP so any incorrect terms please let me know.

It seems padding the time domain signal can make the magnitude spectrum look 'nicer', the fact it doesn't gain any more useful information about the original signal makes sense since there isn't more useful data being added. But to me, the padding can be seen as just multiplying a step function on top of the original signal to form a longer time sequence, i.e. the step function goes to 0 where the padding starts. But if this is the case, why isn't there any sort of sinc-like features in the Fourier transform, indicating any step like or abrupt change in signal down to 0? I've tried researching this but all i seem to find is there are some continuous bumps due to padding but it has to do with interpretation and not with a step function. Is there a way of relating the two?

It's a similar question with windowing which i have, where i see a basic windowing function like placing a large sinusoid (1/4 wavelength) over the sampled data effectively bringing the end and start to 0, but why isn't there a massive peak of this 'frequency' in the FFT?

$\endgroup$

3 Answers 3

9
$\begingroup$

The OP is showing very good insight in all the comments stated. A product in the time domain with a rectangular pulse is convolution in the frequency domain with a Sinc. In fact zero padding in time will result with the spectrum in frequency being convolved with a Dirichlet Kernel (which is basically an aliased Sinc function as the Fourier Transform of a sampled rectangular pulse). This is consistent with "perfect interpolation" as done by convolving a waveform with a Sinc (which can only be approximated in practice since a true Sinc extends to infinity). Further, if we were to zero pad out to infinity, the result of the DFT would converge to a continuous function in frequency referred to as the "Discrete Time Fourier Transform" (DTFT). We see this when we compare the formulas for the DFT and DTFT, in that the only difference is the DTFT summation extends to infinity.

DFT:

$$X[k] = \sum_{n=0}^{N-1}x[n]e^{-j2\pi n k/N}$$

DTFT:

$$X(\omega) = \sum_{n=-\infty}^{\infty}x[n]e^{-j2\pi n k/N}$$

The two are very similar with the additional detail that when $x[n]$ is a fixed length sequence of its non-zero values, the DTFT is zero-padding the DFT out to infinity!

Perhaps the OP just isn't zero padding enough to make out the actual Sinc. Here's a simple example clearly showing the Sinc that would result, starting with a frequency exactly on bin center so that there is no spectral leakage, and then the same signal with zero padding out to ten times it's length (changing the single impulse in frequency, which is really just samples of a Sinc with all samples but the center one in a null, to then have 9 more samples in between each of these nulls revealing the Sinc shape of the underlying Discrete Time Fourier Transform!).

DFT and zero padded DFT

There are 100 samples in the bottom result, I rescaled the horizontal axis by dividing the sample index by 10 so as to line up the two results.

Python code used:

N = 10
n = np.arange(N)
k = 2
time_sig = np.exp(1j * 2 * np.pi * n * k/N)
freq_sig1 = fft.fft(time_sig)
n2 = np.arange(10*N)/10
freq_sig2 = fft.fft(time_sig, 10*N)

plt.stem(n, np.abs(freq_sig1))
plt.axis([0, 9, 0, 10])
plt.stem(n2, np.abs(freq_sig2))
plt.axis([0, 9, 0, 10])

As far as the intuition with the OP's second question on windowing: yes the interpretation is correct that the sinusoidal weighting should be consistent in the frequency domain with doing that weighting in time. What we are seeing then is an Large Carrier -Double Sideband AM Modulation (and with this I bring it the point that the DFT over a finite duration will have an equivalent result in frequency as that with the same time domain waveform periodically repeating). Thus if we were to window with a pure sinusoidal window, the result in frequency would have two sidebands off the "carrier" spaced from the carrier by the modulation frequency: When we AM modulate a carrier tone, we don't see the sum of the tone with the modulation, but we see the modulation as sidebands on the tone (and then if it is "large carrier" we see the carrier frequency as well).

Typical windows used are more complicated than a single sinusoid, resulting in more frequency components on each side of the carrier. What we do see consistent with this in the DFT with windowing is a broadening of the tone in the frequency domain.

Demonstrating this, I multiplied the above test sequence with a simple raised cosine window:

Raised Cosine Window

Then multiplying the 10 sample sequence with this window and then taking the FFT, without any zero padding, results in the following which is consistent with the Large-Carrier Double-Sideband AM modulation model I described: The window is one cycle of a sinusoid, and in the DFT result we see a tone of each side of the carrier offset by the frequency of that one cycle in the window.

FFT after windowing

$\endgroup$
4
$\begingroup$

@George kirby. I suggest you discard that notion of "multiplying a step function on top of the original signal to form a longer time sequence". I believe such a multiplication is not possible.

I interpret zero-padding as follows: Associated with every N-sample input time sequence is a continuous complex-valued discrete time Fourier transform (DTFT). That is, a spectral representation (of the input sequence) whose frequency range goes from minus one half the input sequence's sample rate -to- just less than plus one half the input's sample rate. I say "continuous" because the frequency variable of the DTFT is continuous.

Now, with a digital computer, we cannot compute the actual continuous real and imaginary parts (plotted as curves) of the DTFT. But what we CAN do is compute equa-spaced "samples" (points on the curve) of the DTFT using the discrete Fourier transform algorithm. If the input sequence has N samples we use an N-point DFT to compute N complex DTFT samples equally spaced along DTFT's frequency axis.

If we zero pad the input sequence out to a length of 4N and compute a 4N-point DFT on that lengthened time sequence we will have computed three new spectral samples in between each of the original N DFT samples. Our new 4N DFT samples give us a "finer granularity picture" of the original N-sample input sequence's DTFT.

$\endgroup$
2
$\begingroup$

lots of good stuff in the above answer. But you can absolutely see the sinc function in the frequency domain - just pick a sin wave that's got a period that evenly divides the new signal length. For instance, pick a sin wave with a period of 64 samples. Put 6 cycles in, and then zero pad by 128 more samples. Take the FFT, and here is your magnitude plotenter image description here. Zoom in and here you see:enter image description here

It's a little lopsided because of the negative frequency sinc overlap...

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.