Answer the question
In order to leave comments, you need to log in
FFT. How to find the main harmonics of a signal?
Need advice or an algorithm for finding the main harmonics of the signal. For example, there is a signal spectrum (see figure), you can see by eye which main hormones are present in the signal, but here's how to do it in such a way that it can be detected programmatically. In other words, you need to get exactly the same buffer, in which there will be only 20Hz harmonics and in what places of the buffer (512 bytes).
Answer the question
In order to leave comments, you need to log in
Google peak detection algorithm.
In the general case, you need to pass the data through a smoothing filter, correct adjacent peaks, select the fundamental harmonic and use it to search for higher and weaker harmonics.
www.biomedcentral.com/1471-2105/10/4
Some useful lines in C#
// Complex[] fftResultComplexFrame
var y = 0;
var dic = fftResultComplexFrame.ToDictionary(c => y++, c => c);
var tops = dic.OrderByDescending(p => p.Value.Magnitude).Take(20).ToList();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question