Clarification on Matlab function "Interpft".

Hello there,
My problem is quite simple. I've been trying to up-sample a time domain signal by exploiting the FFT operator. What I did is quite simple:
  1. FFT to map the signal from Time Domain to Frequency Domain;
  2. FFTSHIFT to center wrt the 0-Frequency bin;
  3. Padding both sides with an equal amount of zeros;
  4. IFFTSHIFT;
  5. IFFT.
The results that I got from the aforementioned algorithm were then compared with the ones carried out by the "INTERPFT" operator. What I found out is that the results are equal when the size of the input sequence is odd. Vice-versa, when the size is even, the results differ.
Then, I checked the "INTERPFT" code in order to understand my mistake. As far as I understood, I put the zeros in the wrong place and I did not take care of the sample at (- Sampling Frq.)/2.
See below the chunk of the code from "INTERPFT":
a = fft(x,[],1);
nyqst = ceil((m+1)/2);
b = [a(1:nyqst,:) ; zeros(ny-m,n) ; a(nyqst+1:m,:)];
if rem(m,2) == 0
b(nyqst,:) = b(nyqst,:)/2;
b(nyqst+ny-m,:) = b(nyqst,:);
end
Can anybody clarify on these steps? Why is it needed to split the energy related to the Frequency bin at (- Sampling Frq.)/2?
Thanks for your time,
Emiliano

Réponses (0)

Produits

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by