# Aliasing when oversampling an inverse discrete Fourier transform?

I have been tooling around with the discrete Fourier transform, and have noticed that when I try to oversample the inverse transform, I get aliasing effects.

I am utilizing the formulae from here

For example, taking $$f = x(x-0.8)(x+1)$$, and sampling it at 50 equally-spaced points on $$[-1,1]$$, the DFT gives an (absolute value) spectrum like so (I didn't bother normalizing the units):

If I evaluate the inverse DFT at exactly the $$x$$-datapoints I started with, I get back the original $$y$$ data. However, if I evaluate the inverse DFT at points $$z$$ in-between the original data $$x$$ by oversampling $$[-1,1]$$ at 100 equally-spaced points, I get a constant value at the in-between points! (original data in blue, inverse DFT evaluated on the oversampled points in red)

At first I thought that this was due to the fact that the DFT only gives the first so-many coefficients of the Fourier series. However, when I compute a Fourier transform symbolically, and truncate the series to the same number of terms, I can oversample away and I do not get these aliasing artifacts:

What is happening here? Shouldn't the DFT coefficients approximate the "real" FT coefficients? Is there some "regular" error in the DFT coefficients (as measured against the "real" FT coefficients) that produces this aliasing effect?

• @reuns, AH! I see now that I am not getting, in fact, a constant value at the interpolated points. I'm getting complex values, and my plotting software is simply ignoring the complex part! – Scott Aug 28 '19 at 14:32

You need to understand the difference between $$\frac1N\sum_{k=N/2+1}^{N/2-1} X(k) e^{2i \pi k t/N} + \frac{X(N/2)}{2}(e^{i \pi t}+e^{-i \pi t}) \qquad and \qquad \frac1N\sum_{k=0}^{N-1} X(k) e^{2i \pi k t/N}$$
For integer $$t$$ it doesn't make a difference but when oversampling it does.
By the way if $$x(n)$$ is real then $$X(k) = \overline{X(-k)}$$ and only the first formula is real for all $$t$$.
Oversampling the first formula gives the smoothest (in least square variation sense) interpolation of the $$N$$-periodization of $$x(n),n \in 0\ldots N-1$$.
If $$x(0)-x(N-1)$$ is large then the interpolation won't look very smooth on $$[-1,0]$$ and you'll have some oscillation in the neighbor intervals (this is what windowing is useful for).