2
$\begingroup$

When a complex digital signal is converted to its spectrum through an FFT, the result will contain a series op positive and negative frequencies. That is, when the spectrum has N bins. Bin 0 will be the DC, bin 1->N/2 will be the positive frequencies and bin N-1 -> N-N/2 will be the negative frequencies. In this case it is clear that bin N/2 represents the radial frequencies $\pi$ and $-\pi$ at the same time.

Now, If we zeropad the middle of the spectrum (e.g: when upsampling) such that its new size will be M, we obtain a new one as follows. $X$ is the small spectrum. $Y$ is the zero padded larger spectrum.

  1. $X_{[0:N/2[}$ is mapped to $Y_{[0:N/2[}$
  2. $X_{]N-N/2:N[}$ is mapped to $Y_{]M-N/2:M[}$

In the above, I skipped the middle bin ($X_{N/2}$) because it is not yet clear whether it should assigned to the positive or negative section of the new signal.

To better understand what would be the best result, I performed a small test by creating a random spectrum of length M, then converting it to the timedomain, picking out every M/N-th sample and then converting it back to a spectrum, but this time of length N. The result showed that the following is true for any random spectrum:

$X_{N/2}=Y_{N/2}+Y_{M-N/2}$

Further testing revealed that indeed, we can split the value of the middlebin however we want, as long as their sums match the original value. Yet, the interpolations between the samples (when converting $Y$ back to the timedomain) oscillates differently for each particular choice.

The following three images show the effect of the middle bin on the phase of the upsampled signal. The first one places the middle-bin at N/2 in the new spectrum. The second image splits the content over bin N/2 and M-N/2 and the last one maps the middle bin solely to M-N/2

enter image description here enter image description here enter image description here

As you see the interpolation goes each time exactly through each of the blue values. The only difference is how the interpolation oscilates.

Is there any rule-of-thumb (and why), or any argument/standard practice on how to split the value of the middle bin when zero padding ?

$\endgroup$
  • 1
    $\begingroup$ Can I please ask why do you think it matters this much? In the meantime, please note that it is more important to know the physical frequency that an FFTs bin corresponds to which is $f_k=\frac{k \cdot F_s}{N_{FFT}}$ where $k$ is the frequency bin, $N_{FFT}$ is the number of points the FFT is evaluated on and $F_s$ is the sampling frequency. You can choose $N_{FFT}$ to be even and then you don't have to "split" anything, or, for a given $N_{FFT}$, double it and "half everything" (Up to your acquisition limit of course). $\endgroup$ – A_A Aug 5 '16 at 7:47
  • $\begingroup$ It matters a lot when upsampling. The middle frequency affects the end results substantially between the interpolation points. dsp.stackexchange.com/questions/6177/… is an example of the type of ringing you get if done incorrectly. $\endgroup$ – user7488 Aug 5 '16 at 8:07
  • $\begingroup$ Thank you. The point about upsampling is not mentioned in the question and I think that it's an important one. Otherwise, it's just a discussion about a detail of the FFT. So, getting back to the subject, the (anti)question remains, why not even number of points? Also, I think it would be good if you had a look at this link on how fractional up/down sampling is achieved. Order of operations matters. $\endgroup$ – A_A Aug 5 '16 at 9:08
  • $\begingroup$ The question is actually about an even number of points (I don't know many FFT's with an uneven one tbh). With an even number of points, bin N/2 represents both pi and -pi rad/sample. $\endgroup$ – user7488 Aug 5 '16 at 9:52
  • 1
    $\begingroup$ see: dsp.stackexchange.com/questions/331/… $\endgroup$ – user14819 Aug 19 '16 at 5:30
1
$\begingroup$

One potential issue here is that you are technically in violation of the sampling theorem. Having non-trivial energy at Nyquist is typically an indication that the signal wasn't sufficiently low pass filtered before being sampled. So chances are you already have aliasing. If the Nyquist energy is low enough, it doesn't matter how you split it.

Zero padding past Nyquist to upsample introduces a frequency domain "brick wall" filter between Nyquist and Nyquist + 1. You can certainly go through with the mathematical procedure but I would not expect this to closely match the behavior of the original signal.

$\endgroup$
  • $\begingroup$ Thank you for the insight. In case the signal was real you would be correct (that is: only signals < the Nyquist frequency can be represented), However this is not true for complex signals. There you can represent signals <= the Nyquist frequency. So, I'm not sure about the technical violation you mention. $\endgroup$ – user7488 Aug 19 '16 at 21:01
  • $\begingroup$ About the 'brick wall filter': upsampling like this is actually done and leads to very good results. E.g: when upsampling a real signal it is clear how to split the middle bin. $\endgroup$ – user7488 Aug 19 '16 at 21:02
0
$\begingroup$

The Nyquist frequencies $\pi$ and $-\pi$ are the same in the DFT (e.g., if you think of the DFT as a filter bank, the filters for these frequencies are identical). Without more information about the signal (namely its exact bandwidth and center frequency), you can't say which method is correct. However, a common practice is to split the Nyquist bin in half when upsampling in order to preserve the spectral symmetry of real-valued signals. That way the upsampled version of a real signal is also a real signal.

Some references:

[1] http://www.embedded.com/design/other/4212939/Time-domain-interpolation-using-the-Fast-Fourier-Transform-

[2] http://ieeexplore.ieee.org/xpl/articleDetails.jsp?arnumber=1086169

$\endgroup$
  • $\begingroup$ You ask information on the exact bandwidth of the original signal: $X$ represents the signal exactly. That is: the exact bandwidth of the signal is the bandwidth of $x$. $\endgroup$ – user7488 Aug 19 '16 at 5:38
  • $\begingroup$ I'm only saying that, for example, one could know that an analog signal $x(t)$ (before sampling) has all its energy at $+\pi$ and none at $-\pi$, and then you could could make the correct choice when resampling the discrete time signal $x[n]$ or interpreting its DFT $X$. Without that information, the interpretation of the Nyquist bin is arbitrary/ambiguous. $\endgroup$ – Brian Hawkins Sep 30 '16 at 20:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy