I have a number of signals that are periodic. I use an fft transformation to obtain the dominant frequency of each signal. In order to increase the frequency resolution I zero pad the signal before the fft. However I noticed that when the frequency is low, the peak of the fft corresponds to the first harmonic. A sample of my signal looks like this:
My code is the following:
N = 4000; %signal length minf= 0.5; % Hz maxf= 20; %Hz resf = 0.01; % Hz resolution fs = 2000; % Hz sampling frequency NFFT = fs/resf; Freq = fft(mysignal,NFFT); Freq = Freq((minf/resf)+1:(maxf/resf)+1,:);
In this case the fft will perform well and detect the 1.12Hz frequency. However I noticed that when my signal's frequency is below 1Hz, as dominant frequency I will get the 1st Harmonic as the pick of the fourier domain plot and not the dominant frequency. In that case I can change the line
NFFT = fs/reso_freq; to
NFFT = fs/reso_freq/2; which will actually give me the correct frequency, but it will not work for when my signal is above 1Hz. Can someone explain to me why this is the case and if there is a universal way of finding the correct frequency without knowing what to expect beforehand.