FFT in MATLAB: wrong 0Hz frequency
- by roujhan
Hello
I want to use fft in MATLAB to analize some exprimental data saved as an excell file.
my code:
A=xlsread('Book.xls'); G=A'; x=G(2, : );
N=length(x);
F=[-N/2:N/2-1]/N;
X = abs(fft(x-mean(x),N))
X = fftshift(X);
plot(F,X)
But it plots a graph with a large 0Hz wrong component, my true frequency is about 395Hz and it is not shown in the plotted graph.
Please tell me what is wrong.
Any help would be appreciated.