# Extracting Peak Frequencies Using FFT vs. Time Domain Peak Finding

I am trying to compare two processing algorithms that I believe should be producing very similar results. I am processing acceleration signals over the course of the day and we expect to see a decrease in dominant frequency midday and an increase in the frequency at night. The frequency should be ~0.3 Hz and increase and decrease (by ~0.05) depending on the time of day.

My sampling frequency is 64 Hz and I am trying to run this analysis on the data we already have, so unfortunately we cannot run this experiment again with a lower sampling frequency.

First method using FFT:
1) I apply a bandpass filter on about a ~4 hour chunks of the signal allowing 0.1 Hz to 0.5 Hz. This leaves me with a signal of about 900,000 samples.
2) I then run a cross-correlation on this signal
3) I'm using MATLAB, and run the pwelch function on the cross-correlated signal. I run this with a gaussian window of length 3,500. 50% overlap.
4) I then attempt to smooth out the FFT spectrum with a Savitzky-Golay filter.
5) I fit the peak with the peakfit function
6) I extract the peak frequency within the 0.2 - 0.4 Hz range and call that the dominant frequency for that 4 hour chunk of time.

Second method using time-domain processing:
1) I run the same bandpass filter as above on the signal, same time chunk. I do not run a cross correlation.
2) I find all the peaks in the filtered time domain signal using the findpeaks function
3) I then find the difference between the successive peaks and create a histogram, which looks like a normal distribution centered on a certain period
4) I calculate the mean period of this distribution
5) I take the inverse of the mean period and call that the dominant frequency for that 4-hour chunk

I then run these algorithms on 3 weeks of a continuous acceleration signal and obtain very similar frequencies using both methods. However, about 25% of the peak extractions on the FFT seem wildly off and noisy. For example from point-to-point, meaning from one four-hour chunk to the next four-hour chunk, the frequency change is 50-100% different. On the other hand our second method (the time-domain method) never shows this kind of noise or variance and the transition to different time periods is much smoother and what we expect.

I feel like I can keep playing around with the window lengths/different windowing methods with the FFT, but I had a few questions first.

1) I haven't found any thing in the literature with a similar description to what I am doing with my time-domain method. Am I doing something completely unnecessary here? Is our method valid or just arbitrary? Should I just focus on doing FFT processing? This method makes sense to me, but I cannot back up this method with any relevant literature.

2) Because the time series of extracted frequencies using my FFT method is somewhat noisy, I am leaning towards moving forward with my time-domain method, making my first question more pressing to justify because we would like to publish these results.

3) I'd be happy to hear thoughts on either of these algorithms

Thanks!

• A more popular time domain method is the zero crossing method. Less computations involved and more robust that peak finding especially with even harmonics and noise. You could simply count the number of rising zero crossings and estimate your frequency
– Ben
Feb 20, 2018 at 21:04
• I had not heard about the zero crossings method. I'll look into that. Thanks @Ben!
– Dom
Feb 20, 2018 at 21:58
• There might be one or two problems with the approaches, can you please talk a little bit more about: Are you looking at evaluating the amplitude of a specific frequency or range of frequencies? How long does your bandpass turn out to be and what type is it? When you say that you run the "cross-correlation", do you mean that you effectively get the auto-correlation of your signal? Otherwise, what are you cross correlating it with? How long is the FFT? When you say 0.05, is that percentage or absolute difference in power? What exactly is the signal? Natural? Man-made?
– A_A
Feb 21, 2018 at 6:18
• see benjamin kedem's text or papers for clear discussions on time series analysis of zero crossings. His text is " TIme Series Analysis By Higher Order Crossings". Apr 5, 2018 at 16:57
• @Dom, Could you please review my answer? If it fits you, could you please mark it?
– Royi
Oct 20, 2022 at 16:41

You basically have a slowly changing Sine signal where the parameter which changes is its frequency.

The right approach in my opinion would be to use Frequency Modulation processing of the signal.
Since you are dealing with really low frequencies yet your observation period is long you should be OK and have good results.

There are many solutions to this problem by Fourier Analysis on input spectrum, oversample ratio and number of data points. Matlab, Excel: custom histogram, Audacity, other....

But let me show you how I generated this plot using the Windows\Media\Windows Critical Stop.wav .

open file {select type}
select all {signal waveform}
Effects > Paulstretch {factor=100,resolution = 0.005 s}
Effects > BassandTreble {Bass=0,Treble=-20dB repeated 4x (200Hz)}
Analyze > Plot Spectrum { Spectrum, Welch window , size=65536 (max), log f} zoom window, scroll up

Any questions?

When it comes to signal processing, garbage in, garbage out unless you match filter to spectral input and have high SNR data and capture digitizing methods.

By time stretching by 100x factor and 200Hz LPF, I shifted spectrum down to <500Hz at 20dB noise bandwidth with SNR >> 40dB. Choice of filter depends on desired group Delay specs and BW edge peaking or ripple factors. Bessel is often best due to lowest Q, unless strong adjacent spectrum interference.