Skip to main content
1 of 9
Dan Boschen
  • 55k
  • 2
  • 59
  • 143

The OP is asking how to do zero padding of an sequence representing DFT samples completely in the time domain. This answer is instructive in basic DFT properties but will also demonstrate the simplicity of doing this in the frequency domain.

Zero padding in the frequency domain interpolates more samples in the time domain. The value for each new time domain sample is the result of a circular convolution in the time domain with the Dirichlet Kernel, which generally has a magnitude given as:

$$|D(n, N, M)| = \bigg|\frac{\sin(N \pi n/ M)}{M \sin(\pi n/M)}\bigg| \tag{1}\label{1}$$

Where:

$N$ is the original number of DFT samples,

$M$ is the total number of samples after zero-padding.

The angle of the Dirichlet Kernel depends on where we pad the DFT sequence. If the padding is done in the proper center of the DFT sequence (which represent the higher frequency bins), and when the length of the original sequence is odd, the resulting Dirichlet Kernel will be real resulting in no additional phase shift and given by:

$$D(n, N, M) = \frac{\sin(N \pi n/ M)}{M \sin(\pi n/M)}\tag{2}\label{2}$$

For all other cases, which would be a circular rotation of $m$ samples from this zero-phase case, the additional phase shift is given by:

$$\phi(m) = e^{jm 2\pi n/M} \tag{3}\label{3}$$

Where $m$ represents the number of samples for a circular rotation to the right for $m$ positive.

The "proper center" and reason for the requirement on an odd length results in "zero-phase" interpolation (introducing no additional phase shift) and is understood with the aid of the graphic below, introducing terminology I will use:

DFT padding for zero-phase interpolation

The graphic above shows the resulting window that is effectively multiplied with an N-sample DFT sequence when we "zero padding in the middle of the DFT sequence". This is as typically done with OFDM waveforms, which as mentioned results in time domain interpolation without introducing an additional linear phase shift with time (which would correspond to a frequency shift in the frequency domain). The first bin in the DFT sequence is the "DC bin" representing the magnitude and phase of the DC component of the signal, the next bins correspond to "positive frequency" bins, representing the magnitude and starting phase for frequency components as rotating phasors rotating counter-clockwise on the complex plane (such as a bicycle wheel rotating forward), while the bins at the end of the sequence correspond to "negative frequency" bins, representing the magnitude and starting phase for frequency components as rotating phasors rotating clock-wise on the complex plane (such as a bicycle wheel rotating backwards). Thus we see if there is a corresponding positive frequency bin for each negative frequency bin of equal magnitude and opposite phase, the result will be real and have zero phase. We achieve this in the window above for the case of an odd number of total samples: the same number of positive and negative frequencies, plus the DC bin, will result in a total number of samples that is odd. From this we also see that it does not matter if the total length of the padded sequence is odd or even; the resulting Dirichlet Kernel which is the inverse DFT of this window will be real and result in "zero-phase interpolation" in the time domain.

With that understood, and recapping the bottom line is zero-padding in the center of the DFT sequence as detailed above will result in interpolating new time domain samples without introducing phase error; we now can face the complexity of the details of properly doing the interpolation in the time domain (instead of the simplicity of taking the inverse FFT of the zero-padded sequence).

Multiplication in the discrete frequency domain with such a discrete rectangular window is identical to a circular convolution in the time domain with the Dirichlet Kernel. By zero-padding the DFT sequence, we have effectively either increased the sampling rate or decreased the total time duration of the time domain signal (expand the frequency domain or compress the time domain). Let's assume for clarity of my descriptions that we have increased the sampling rate of what was effectively a pre-existing time-domain signal such that we will introduce new samples at time locations that are in between the original time domain samples.

Therefore, in order to proceed with an interpolation completely in the time domain, we need to create the new sample time indices for the interpolated samples, compute the Dirichlet Kernel for those indices, and then complete a circular convolution of the Dirichlet Kernel with the original time domain waveform (as given by the inverse DFT of the original frequency domain sequence prior to zero-padding). This is straight-forward when the inverse DFT results fall on the new sample time indices, and can proceed as described. However for all general cases would require an intermediate step of interpolating to the greatest common factor, or completely alternate interpolation approaches rather than convolving with the Dirichlet Kernel (in this case why not the alternate approach of zero pad the frequency domain and take the inverse FFT!).

Dan Boschen
  • 55k
  • 2
  • 59
  • 143