필터 지우기
필터 지우기

FFT is finding a max amplitude at 0 Hz

조회 수: 8 (최근 30일)
Aimie
Aimie 2012년 6월 28일
댓글: Iftakharul alam 2020년 7월 28일
Can anyone explain why fft is giving a maximum amplitude at 0 Hz if the actual signal is pretty clear?
In my code, x is the signal as a function of time and r = length(x):
NFFT = 2^nextpow2(r);
X = fft(x,NFFT)/r;
Fs = 1/dt; % sampling frequency
f = Fs/2*linspace(0,1,NFFT/2+1); % frequency
A = 2*abs(X(1:NFFT/2+1)); % ampitude spectrum
  댓글 수: 1
Aimie
Aimie 2012년 6월 28일
I should mention that I do get a second peak in the frequency at around 200 Hz, which is exactly what I want. I just want to get rid of the maximum peak occurring at 0 Hz...

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

채택된 답변

Honglei Chen
Honglei Chen 2012년 6월 28일
You need to remove the DC component first. Just do
x = x-mean(x)
or
x = detrend(x)
before applying FFT
  댓글 수: 2
Aimie
Aimie 2012년 6월 28일
Thanks! This works great. I had tried to do something similar by using
x = x - x(1)
but using detrend was a much better way to go (but I didn't know about that function before).
Iftakharul alam
Iftakharul alam 2020년 7월 28일
Dear Honglei Chen,
really appreciated to see you answer!
Thank you so much.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Fourier Analysis and Filtering에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by