Sampling frequency and FFT output ?

21 次查看(过去 30 天)
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.

采纳的回答

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

更多回答(2 个)

Wayne King
Wayne King 2012-10-12
编辑:Wayne King 2012-10-12
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 个评论
Matt J
Matt J 2012-10-12
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 2012-10-12
编辑:Wayne King 2012-10-12
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.

请先登录,再进行评论。


Matt J
Matt J 2012-10-12
编辑:Matt J 2012-10-12
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 个评论
Invizible Soul
Invizible Soul 2012-10-12
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."

请先登录,再进行评论。

标签

Community Treasure Hunt

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

Start Hunting!

Translated by