fft: significant peak in 0 Hz component
204 views (last 30 days)
I'm recently dealing with a problem about finding the frequencies of a data vector using fft. I've read in some sources that the 0 Hz component comes from the mean so I need to detrend the data.but there is no visible change in my output. the 0 Hz component still dominates significantly. If it helps, the vector contains velocity values over time and MY SAMPLE FREQUENCY IS 1HZ. (I've attached my sample data)
N = length(Data(:,1));
Ts = 1;
W = 0:2*pi/N:2*pi*(1-1/N);
X = W / Ts;
Fx = fft(Data);
plot(X,abs(Fx));ylabel('fft of V_x');xlabel('Ferq(HZ)')
Greg Heath on 4 Apr 2014
One of the basic assumptions is that that your data is a finite window sample of an infinitely periodic function. Very often there is a polynomial trend to the data which violates this assumption. The function detrend can, in general, remove linear trends
However, sometimes I find it necessary to remove quadratic trends (especially in the acceleration data of a tumbling and spinning radar target which is undergoing gravitational acceleration).
Sometimes you can plot and "see" a polynomial trend. Sometimes looking at the differences in the plots and spectra of x, diff(x) and diff(diff(x) are helpful.
I have never dealt with a trend higher than quadratic.
The importance of removing significant trends is that their spectral sidelobes contaminate, often overwhelmingly, the low frequency spectra of the true periodic components.
Hope this helps.
Edited: Carlos on 4 Apr 2014
From your code and the file uploded I can see ypur sampling frequency is 1000 Hz and you are trying to represent frequencies up to 6000Hz.
>> NFFT = 2^nextpow2(N); % Next power of 2 from length of y
Y = fft(Data,NFFT)/N;
f = (1/Ts)/2*linspace(0,1,NFFT/2+1);
% Plot single-sided amplitude spectrum.
title('Single-Sided Amplitude Spectrum of y(t)')
The DC component has disappeared as you can see in the attached file