sinc_interp() vs resample()

    Newer Older

    True sinc() interpolation (in blue) is not the same as FFT resample() interpolation (in red), though they are close. Known samples are the dots, vertical lines are the boundaries of a single period.

    The difference is because the FFT interpolation assumes that the signal is periodic; it repeats outside the known values. The sinc() interpolation assumes that the signal is zero outside the known values (ringing in this case). You can make them closer by padding the signal with zeros before resample(), but it will never be exact.

    See Time-domain interpolation using the Fast Fourier Transform (Richard Lyons):

    Here’s the second issue regarding time-domain real signal interpolation, and it’s a big deal indeed. This exact interpolation algorithm provides correct results only if the original x(n) sequence is periodic within its full time inter­val.

    1. TedliMan 29 months ago | reply

      Your analysis is slightly flawed, but I fear it is my fault. I'm the author of the "True sinc() interpolation" page that you link to. I think I will modify that page sometime in the near future to clarify things a bit better.

      It is not correct to say that "FFT interpolation assumes that the signal is periodic" and that sinc interpolation does not. If the underlying signal, as you suggest here, had finite support (i.e., it was zero outside of the window of interest), then it would not be bandlimited. Consequently, it could not be recovered by sinc interpolation. You could use something like sinc interpolation to fill in the gaps between points, but your interpolation technique would be arbitrary at that point. That is, you would not be reconstructing the original continuous-time signal because too much information was lost in the sampling process. The data would be corrupted by aliasing.

      In fact, that's the reason for the Gibbs phenomenon/ringing that you see here. The finite approximation of sinc interpolation effectively multiples the time-domain signal by a boxcar, which convolves its frequency-domain representation with a sinc thereby growing its frequency-domain support so it is not bandlimited. When you re-sample that signal, you see the aliasing from those copies of the non-bandlimited signal. That aliasing shows up as the ringing. The true continuous-time signal was flat everywhere outside of the window, but that sharp transition was lost in the sampling process.

      A true sinc interpolation is impossible as it requires a true circular convolution, which is infinite. So we use the circular convolution theorem to implement true circular convolution with an FFT.

      You might argue that this is just a difference is interpretation. However, you *cannot* reconstruct a signal using sinc interpolation if that signal was originally bandlimited. It's impossible. It's not a well-formed problem.

      Sinc interpolation is just another way for to say you're filtering out the Nyquist window of interest and re-sampling. If your signal was not band-limited to begin with, that Nyquist window will be polluted with the tails of other Nyquist windows.

    2. TedliMan 29 months ago | reply

      (I just want to stress that the DFT (and then FFT, of course) implementation of sinc interpolation is *NOT* an approximation; it is the only way to implement sinc interpolation in a finite computation)

    3. endolith 29 months ago | reply

      I don't understand your objection. If you take a boxcar function, for example, and band-limit it, it will no longer be time-limited. The filtering will produce ripples. If you then sample it, such that the samples fall on the zeros of the ripples, you will have a discrete signal that is zero outside of some range. If you then replace each sample with a sinc function, you exactly reconstruct the original band-limited continuous signal. Reconstructing a band-limited signal using sinc interpolation is sampling theory 101, no?

    4. TedliMan 26 months ago | reply

      Again, "A true sinc interpolation is impossible as it requires a true circular convolution, which is infinite. So we use the circular convolution theorem to implement true circular convolution with an FFT."

      What is called "True sinc interpolation" is itself an approximation of real sinc interpolation (done to help aid in the understanding of what sinc interpolation is ideally). Real sinc interpolation is impossible to implement in the time domain in general. You leverage the band-limitedness to implement in the frequency domain with FFT. It is the FFT that is "true" sinc interpolation. Consequently, it's no surprise that the FFT re-sampling generates a periodic signal when you extrapolate here. It would be a surprise if it generated a signal with finite support in the time domain.

    5. TedliMan 26 months ago | reply

      Let me put a slightly different spin on it. Take the FFT of both of your interpolated signals -- the "true sinc_interp" one and the resample one based on the FFT. Which one matches the original FFT?

      Based on the answer to that, would you still hold that the FFT resampling is an approximation of something implemented "truly" in the time domain? Or is it really the other way around?

      You can use sinc interpolation in the time domain to get an aperiodic signal, but count on some harmonic distortion. Is that really what you want?

    keyboard shortcuts: previous photo next photo L view in light box F favorite < scroll film strip left > scroll film strip right ? show all shortcuts