MATLAB: Band of a fft signal

bandfourier

How can I calculate the frequency band of a Fourier Transformed signal?
In vector X I have the values of my aperiodic signal
Then I do fft(X), so I have my signal in function of frequency
Now how can I know its band?

Best Answer

Hi, you have to know the sampling frequency of your input. If you have the Signal Processing Toolbox, the easiest way is to use spectrum.periodogram because that does a lot of the work for you.
I'll assume that your sampling frequency is 1000 Hz for this example.
Fs = 1e3;
t = 0:1/Fs:1-(1/Fs);
x = cos(2*pi*100*t)+sin(2*pi*200*t)+randn(size(t));
plot(psd(spectrum.periodogram,x,'Fs',1e3,'NFFT',length(x)));
With fft(), note I have not scaled the output to exactly match spectrum.periodogam, but that is easy.
xdft = fft(x);
xdft = xdft(1:length(x)/2+1);
freq = 0:Fs/length(x):Fs/2;
figure;
plot(freq,20*log10(abs(xdft)));