MATLAB: Choosing FFT points

fft points

Hi All. It is not clear to me how to choose points in a FFT, and matlab Help, doesn't help on this. E.g., I have an L long array and I want an fft window of 32ms (which is 704 samples with a fs of 22kHz); fft(X(1:704)) gives me 704 frequency bins by default, but I want only a subset of frequency "lines", and specifically I need M=128 frequency bins. I tought I would just use the syntax fft(x(1:704),128), however:
x1=ifft( fft( x(1:704),128 ), 704)
is not equal to
x1=ifft( fft( x(1:704) ) )
Why?? (thanks)

Best Answer

The bins in the DFT are Fs/N where N is the length of the input vector and Fs is the sampling frequency.
If you only want to evaluate the DFT at a subset of 128 DFT bins, then you can select those from the output of fft()
Also, see the help for goertzel(), which evaluates the DFT at specific bins.