What exactly is the "n-point DFT" that fft() computes?

180 views (last 30 days)
I am trying to understand exactly how matlab is computing the fft when you call fft(myData, N), where N < length(myData).
Is it basically doing something along the lines of FFT pruning, as described by: Pruned FFTs?
In other words, it is computing the "first K outputs of an N point FFT" as detailed in the above link from fftw.org?
Thanks

Accepted Answer

Jonathan
Jonathan on 23 Sep 2014
I found a site where you can get intelligent answers to your questions: FFT Matlab - What is a N-point FFT?
If you are going to perform a N-point FFT in MATLAB, to get an appropriate answer, the length of your sequence should be lesser than or equal to N. Usually this N is chosen in power of 2, because MATLAB employs a Radix-2 FFT if it is, and a slower algorithm if it is not.
So, if you give a sequence of length 1000 for a 2056 point FFT, MATLAB will pad 1056 zeros after your signal and compute the FFT. Similarly, if your sequence length is 2000, it will pad 56 zeros and perform a 2056 point FFT.
But if you try to compute a 512-point FFT over a sequence of length 1000, MATLAB will take only the first 512 points and truncate the rest. If you try to compare between a 1024 point FFT and a 2056-point FFT over a [1:1000], you will get a similar plot.
So the moral: choose your N to be greater than or equal to the length of the sequence.

More Answers (1)

Youssef  Khmou
Youssef Khmou on 23 Sep 2014
N is the number of points used to calculate the fft, it does not increase physical resolution but adds more point to the spectrum for more visual resolution, N is arbitrary.
  2 Comments
Jonathan
Jonathan on 23 Sep 2014
Edited: Jonathan on 23 Sep 2014
Yes, I know. But how is it computing this when N<length(data)?
Youssef  Khmou
Youssef Khmou on 23 Sep 2014
Edited: Youssef Khmou on 23 Sep 2014
for every element of the frequency vector X(f), it is a sum of X(t)*exp(-2*pi*j*t*f) where t lies in [1 M], M is the length of the signal, and f lies in [1 N], and N is the value chosen whether N > M or N< M.

Sign in to comment.

Categories

Find more on Fourier Analysis and Filtering in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!