How to chose FFT parameter ?

22 vues (au cours des 30 derniers jours)
Omar thamer
Omar thamer le 12 Oct 2013
Commenté : Omar thamer le 15 Oct 2013
Hello I have a discrete signal run for 512 Sec with one sample per sec. I chose the fft parameter as follow: Fs=1; nfft=1024; f=(0:nfft/2-1)*fs/nfft;
Is that correct ?
Whenever I do an fft for my signal i can seep the peak on zero only. Also there are some peaks on 1024, 512, 256,... Appreciate your help

Réponse acceptée

Image Analyst
Image Analyst le 15 Oct 2013
Modifié(e) : Image Analyst le 15 Oct 2013
Your original question said 1 per second. Now you say 1 per day. Which is it?
You say you get a big spike at zero. That is because your signal does not have zero mean. It is shifted upwards - it has a mean of around 1 or 1.5 times ten to the (something) power. That means you have a lot of energy in the DC (zero frequency) component. I don't see the other spikes at the other frequencies - looks basically like random noise to me. Though because your signal is multiplied by a rect (basically a window the entire size of your signal) that means that your Fourier signal will be convolved with a sinc function, though a very narrow one. Sometimes this gives little ringing to the spikes. And of course if your signal is not the same at the left and right on the x axis, you will have a discontinuity which will also introduce higher frequencies. They way to reduce that is to window your signal. Look up Hanning or Hamming Window for more info.
Helpful links:
  3 commentaires
Image Analyst
Image Analyst le 15 Oct 2013
If you don't want the big spike at zero, you can subtract the mean from your signal so that the new mean is zero
newSignal = signal - mean(signal);
Omar thamer
Omar thamer le 15 Oct 2013
Modifié(e) : Omar thamer le 15 Oct 2013
Thank you it works. Last question about sampling frequency To be precise my data for 512 working days and sampled each day. So length is 512. I put fs=1 n=1024 i still can see peaks on the fold on 2 base (i.e 1024, 512, 256, ...) which does not make sense. the bin obtained by these parameter is very high. (1/1024) Any suggestions ?

Connectez-vous pour commenter.

Plus de réponses (1)

Youssef  Khmou
Youssef Khmou le 12 Oct 2013
Fs should be at leats twice the maximum frequency in the signal , and the number NFFT increases resolution only , example :
Fs=80;
t=0:1/Fs:2-1/Fs;
y=sin(2*pi*t*35);
N=1024;
fy=fft(y,N);
freq=(0:N-1)*Fs/N;
figure, plot(freq(1:end/2),abs(fy(1:end/2)))
  3 commentaires
Youssef  Khmou
Youssef Khmou le 15 Oct 2013
Modifié(e) : Youssef Khmou le 15 Oct 2013
thats sound normal, the signal contains near zero frequency :
try :
figure, plot(abs(fft(signal)));
same spectrum?
Omar thamer
Omar thamer le 15 Oct 2013
The fft plot is already for absolute values. I cant see the DC component you are talking about. the signal is varying very clearly. I agree with Image analyst that Zero component is due to shifted signal and no zero mean.

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by