Lets say I want to double the number of points in an array f. I had the idea to do this:

FF=[F(1:N/2) zeros(1,N) F(N/2+1:N)];

But the result is not exactly correct. Why is this?


If N is odd it's a bit simpler:

FF=2*[F(1:(N+1)/2),zeros(1,N),F((N+3)/2:N)]; ff=real(ifft(FF));

This is very close to what you had (apart from the scaling). Also note that due to numerical inaccuraces you have to take the real part of the IFFT operation. However, you should always check that the imaginary part (which you throw away) is very small (in the order of $10^{-16}$ when using double).

If N is even, you need to split the value at Nyquist:

FF=2*[F(1:(N/2)),.5*F(N/2+1),zeros(1,N-1),.5*F(N/2+1),F((N/2+2):N)]; ff=real(ifft(FF));


Doing DFT based interpolation has to keep 3 principles:

  1. Keep the zeros outside the data (Looking form $ -\pi $ to $ \pi $). Namely add zeros to the higher frequencies.
  2. If it is real signal, keep the symmetry (If needed, divide the highest frequency into 2 items).
  3. Preserve the energy (By the division by 2 if needed).

By the way, the interpolation isn't by a Sinc Kernel, it is done with its discrete form - The Dirichlet Kernel.

See The Proper Way to Do Sinc Downsampling (DFT Downsampling) for Uniformly Sampled Discrete Signals with Finite Number of Samples


Your Answer

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

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