Since the calculated FFT will be symmetric such that the magnitude of only the first half points are unique (and the rest are symmetrically redundant), the main idea is to display only half of the FFT spectrum. The following code illustrates this point:
NumUniquePts = ceil((NFFT+1)/2);
FFTX=FFTX(1:NumUniquePts);
MX=abs(FFTX);
MX=MX*2;
However, the DC component of the signal is unique and should not be multiplied by 2:
Also, for odd NFFT, the Nyquist frequency component is not evaluated, and the number of unique points is (NFFT+1)/2.
If NFFT is even, then the FFT will be symmetric such that the first (1+NFFT/2) points are unique, and FFTX(1+NFFT/2) is the Nyquist frequency component of x, which is unique. The rest are symmetrically redundant.
if ~rem(NFFT,2)
MX(length(MX))=MX(length(MX))/2;
end
Try the following short example to see this:
a = [1 2 3 4 5]; A = fft(a)
b = [1 2 3 4 5 6]; B = fft(b)
You can see that A(1) (or B(1)) is the DC component of a (or b). Also, note that B(4) is the Nyquist frequency component of b (even NFFT), and A does not have such component. The divisions by 2 are done to take care of these unique components.
Best Answer