Sampling frequency and FFT output ?

20 views (last 30 days)
What is the relationship between the fs (sampling frequency) and the amplitude of the FFT-function output in matlab? As the amplitude of the FFT output changes as the sampling frequency is changed.

Accepted Answer

Invizible Soul
Invizible Soul on 12 Oct 2012
Thank you guys for your help ... i will get back to you if have any problem. Thanks once again

More Answers (2)

Wayne King
Wayne King on 12 Oct 2012
Edited: Wayne King on 12 Oct 2012
There is a relationship between length of the input signal and the FFT output, not the sampling rate.
Fs = 1000;
t1 = 0:0.001:1-0.001; % 1000 samples
t2 = 0:0.001:0.1-0.001; % 100 samples
x1 = cos(2*pi*100*t1);
x2 = cos(2*pi*100*t2);
xdft1 = fft(x1);
xdft2 = fft(x2);
subplot(211)
plot(abs(xdft1))
subplot(212)
plot(abs(xdft2))
However, if you compute the power spectral density, using something like periodogram(), then the sampling frequency will come into play in scaling the PSD estimate.
Of course, depending on how you sampled the signal (the length and sampling frequency), you may have situations where the frequency does not fall directly on a DFT bin, and the can affect the amplitude.
  3 Comments
Matt J
Matt J on 12 Oct 2012
Fs is not used in Wayne's code apart from the first line, so if you only changed the first line, it's understandable that you would see no effect.
However, changing the amplitude of the input signles x1 and x2 can/will obviously affect the amplitude of the output because of the linearity of the FFT.
Wayne King
Wayne King on 12 Oct 2012
Edited: Wayne King on 12 Oct 2012
Obviously the amplitude depends on the amplitude. If you have a sine wave with amplitude A, then in the magnitude plot for the DFT (fft), you are going to get two lines with magnitude (N*A)/2 where N is the number of samples, and A is the amplitude.
t2 = 0:0.001:0.1-0.001;
x2 = 10*cos(2*pi*100*t2);
xdft2 = fft(x2);
% amplitude at -100 and 100 Hz will be (length(x2)*10)/2
plot(abs(xdft2))
The length of x2 is 100, the amplitude is 10, so the magnitude is predictably (10*100)/2. Again, that is not depending at all on the sampling frequency, it is only depending on the length and of course the amplitude.

Sign in to comment.


Matt J
Matt J on 12 Oct 2012
Edited: Matt J on 12 Oct 2012
The FFT amplitude is related to N, the number of samples in the FFT. You are supposed to choose N to satisfy
N=fs/dF
where dF is the frequency domain sample spacing that you want.
  1 Comment
Invizible Soul
Invizible Soul on 12 Oct 2012
Thank you Matt for your reply. Can you comment on my previous last comment plz i.e. "Thanks for a quick reply. The result does not depend on Fs for the above code. But it does changes when I replace x1 and x2 by x1 = 2*cos(2*pi*100*t1); x2 = 10*cos(2*pi*100*t2); or any other amplitude you want."

Sign in to comment.

Tags

Community Treasure Hunt

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

Start Hunting!