필터 지우기
필터 지우기

sampling rate and fft

조회 수: 65 (최근 30일)
Reed
Reed 2014년 2월 5일
댓글: Reed 2014년 2월 6일
Do I need to specify the sampling rate when using FFT? I am wanting to look at frequency response of a signal, and am getting crazy frequency response, way above sampling rate. Sorry for a very basic question, trying to get up to speed.

채택된 답변

Wayne King
Wayne King 2014년 2월 5일
편집: Wayne King 2014년 2월 5일
No, you don't need to specify the sampling rate, but if you wish to create a meaning frequency vector, then you need to know the sampling rate.
For example:
Fs = 1000; % sampling rate of 1000 Hz
t = 0:1/Fs:1-1/Fs;
x = cos(2*pi*100*t)+randn(size(t));
xdft = fft(x);
xdft = xdft(1:length(x)/2+1);
DF = Fs/length(x); % frequency increment
freqvec = 0:DF:Fs/2;
plot(freqvec,abs(xdft))
so the output of fft() is agnostic about frequency, but if you want to interpret that output in physical frequencies, then you need to know the sampling rate.
  댓글 수: 3
Wayne King
Wayne King 2014년 2월 6일
I am eliminating 1/2 of the fft() output since it is redundant for a real-valued signal if you are just interested in plotting the magnitude.
The syntax above works for an even length signal without warning is your x, your signal an odd number of samples in length?
If that is the case, do
xdft = xdft(1:floor(length(x)/2)+1);
Reed
Reed 2014년 2월 6일
Thank you very much. makes sense, I'm a little slow with this sometimes :(

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Spectral Measurements에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by