View Full Version : endpoint detection
inadaze
Jul13-04, 02:24 PM
Hi all,
I am trying to write a code that can determine peaks in a signal. What I am doing is recording a signal then running an fft to calculate the fundamental frequency and the overtones (consonant and dissonant harmonics). The problem is that some of the peaks are very small but are always distinguishable by looking at the plotted results. Has anyone had any experience with writing a code that could distinguish peaks from noise.
Thanks
Jay
Compute the mean and standard deviation of the values in the bins. Then it should be easy to recognize peaks that are say, two standard deviations greater than the mean.
- Warren
inadaze
Jul13-04, 03:23 PM
Thanks for your reply, but unfortunately I am not that educated in these terms. Could you really spell it out for me...I don't know what is the "mean" and "standard deviation(although I can guess at this)" of values in the "bins".
Sorry to make you elaborate, but I am kinda new to this stuff.
Thanks
Jay
When you take an FFT, the resulting array of numbers is often referred to as an array of "bins," since each number actually indicates the power in a small range of frequencies. You can just call them numbers if you like.
The arithmetic mean of the array is simply the average value. Add all the bins and divide by the number of bins to get the mean. I will denote the values in the bins as x, and the mean of those values as <x>.
The standard deviation is a measure of the spread in the data. Since most of the bins contain nothing but noise and have roughly the same value, the data generally has a small spread. Calculate the standard deviation (\sigma) as
\sigma = \sqrt{<x^2> - <x>^2}
In words, take the mean of the squares of all the bins, subtract the square of the mean of the bins, and take the square root of it all. The resulting number represents how much a typical bin differs from the mean. Any bin that contains significantly more power than the mean plus this typical difference -- say, a bin whose value is several standard deviations above the mean -- is probably a peak.
- Warren
inadaze
Jul14-04, 11:01 AM
When I take an FFT I get a mirror reflection opposite the peaks. Do I take these as well when calculating the mean?
Also, when I calculate the standard deviation it gave me this number:
0 +5.8949e+004i
What does this mean?
do I add this to the mean to find out what is considered a peak?
Or did I do something wrong?
Thanks
Jay
vBulletin® v3.8.7, Copyright ©2000-2012, vBulletin Solutions, Inc.