Sign up ×
Signal Processing Stack Exchange is a question and answer site for practitioners of the art and science of signal, image and video processing. It's 100% free, no registration required.

I am getting a high frequency at 0Hz. How can I remove it? I am not supposed to get it.

My code is

W = 3.64*2*pi;

Fs = 50;                      % Sampling frequency in hz
T = 1/Fs;                     % Sample time
L = 1000;                     % Length of signal
t = (0:L-1)*T;                % Time vector
v = 113*(1+0.40*sin(W*t));

theta0 = 12*(pi/180);         % in radians for 12 degree
theta1 = 6*(pi/180);          % in radians for 6 degree
theta = theta0-theta1*sin(W*t);

Lift = 0.5*1.225*v.^(2)*(2*pi).*theta;

NFFT = 2^nextpow2(L);         % Next power of 2 from length of Lift
Y = fft(Lift,NFFT)/L;
f = Fs/2*linspace(0,1,NFFT/2+1);


plot(f, 2*abs(Y(1:NFFT/2+1))) 
share|improve this question
Small hint. I suggest you to use dec2rad function for conversion to radians. – jojek May 12 '14 at 7:19

1 Answer 1

Frequency bin at zero is simply mean value of your signal. Just take a look on definition of DFT, for zero frequency $k$ we get:

$$\left. X[k]=\sum_{n=0}^{N-1}x[n]e^{-i 2\pi n\cdot k} \right |_{k=0} \Rightarrow X[0]=\sum_{n=0}^{N-1}x[n]e^{-i 2\pi n\cdot 0} = \sum_{n=0}^{N-1}x[n] $$

So after you calculate the FFT and divide by number of samples, indeed you get the mean value of your signal. In order to remove that, please apply the following before the FFT calculation:

Lift = Lift - mean(Lift);
share|improve this answer
It worked. But I don't understand the concept of this frequency bin. Can you explain if possible? – Vinlite May 12 '14 at 6:53
@Vinlite: Please check the updated post. – jojek May 12 '14 at 6:55

protected by jojek Feb 18 at 22:57

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.