필터 지우기
필터 지우기

Sampling frequency and FFT output ?

조회 수: 14 (최근 30일)
Invizible Soul
Invizible Soul 2012년 10월 12일
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