I am doing EEG preprocessing using FFT. The sampling rate is 128 Hz, epoch length is 2s, 256 data points. After I applied fft(), there are still 256 points. What is the frequency resolution and frequency range of the result?
without going into the properties of Matlab, an FFT behaves in such a way that it must satisfy the Nyquist criterion. The highest frequency that can be represented in the FFT is half the sampling rate. So 128Hz/2 = 64Hz in your case. This will be distributed over the 256 samples. Each sample represents 64Hz/256 = 0,25Hz. And often FFT uses a number of samples in the range of 2^N. If you sample only 200 values then the algorithm adds 56 zeros. This is called zero padding.
As your signal length is 2 seconds, the frequency resolution is 1/2s or 0.5 Hz.
The first 128 points represent frequencies from 0 to 63.5 Hz, the last 127 points represent frequencies from -63.5 to 0.5 Hz, the 129 point is +64 or -64 Hz.
You can rotate the spectrum with function ifft to order frequencies from -64 to +63.5 Hz. frequency 0 is then on point 129.