Endpoint Detection: Distinguishing Peaks from Noise

  • Thread starter Thread starter inadaze
  • Start date Start date
  • Tags Tags
    Detection
AI Thread Summary
To determine peaks in a signal using FFT, it is essential to analyze the resulting array of values, often referred to as "bins," which represent power across frequency ranges. The mean and standard deviation of these bin values can help distinguish significant peaks from noise. The mean is calculated by summing all bin values and dividing by the number of bins, while the standard deviation measures the spread of the data, calculated using the formula σ = √(<x²> - <x>²). A peak can be identified as a bin value that exceeds the mean by several standard deviations.When calculating the mean, it is important to consider whether to include mirror reflections of the peaks, as this can affect the results. If the standard deviation calculation yields a complex number, such as 0 + 5.8949e+004i, it indicates a potential error in the calculation, as standard deviation should be a real number. Proper interpretation of these calculations is crucial for accurately identifying peaks in the signal.
inadaze
Messages
20
Reaction score
0
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
 
Computer science news on Phys.org
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
 
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 &lt;x&gt;.

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{&lt;x^2&gt; - &lt;x&gt;^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
 
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
 
In my discussions elsewhere, I've noticed a lot of disagreement regarding AI. A question that comes up is, "Is AI hype?" Unfortunately, when this question is asked, the one asking, as far as I can tell, may mean one of three things which can lead to lots of confusion. I'll list them out now for clarity. 1. Can AI do everything a human can do and how close are we to that? 2. Are corporations and governments using the promise of AI to gain more power for themselves? 3. Are AI and transhumans...
Thread 'ChatGPT Examples, Good and Bad'
I've been experimenting with ChatGPT. Some results are good, some very very bad. I think examples can help expose the properties of this AI. Maybe you can post some of your favorite examples and tell us what they reveal about the properties of this AI. (I had problems with copy/paste of text and formatting, so I'm posting my examples as screen shots. That is a promising start. :smile: But then I provided values V=1, R1=1, R2=2, R3=3 and asked for the value of I. At first, it said...
Back
Top