# Incorrect signal-to-noise ratio estimation

Consider a "pure" sine wave (no visible noise): and let's calculate signal-to-noise ratio of it by (mean to standard deviation): $$SNR=\frac{\mu}{\sigma}$$

here's the code in Python:

t = np.arange(0, 4e-6, 2e-9)
f1 = np.sin(50e6*t)

SNR = np.mean(f1)/np.std(f1)


the result is $$SNR=0.003928$$ (looks low for a pure signal)

and let's "apply" some offset to the data: t = np.arange(0, 4e-6, 2e-9)
f1 = np.sin(50e6*t+10)

SNR = np.mean(f1)/np.std(f1)


and behold $$SNR = 14.133893$$ (but the signal still "pure"!)

What's wrong with this interpretation of $$SNR$$? Maybe I do something incorrect?

• SNR is usually power-to-power. Just finding the mean of a sine wave will always be close to zero (though, as you see, changing the phase will alter this). You need to do something more like $\frac{\sum |x|^2}{\sigma_x}$ instead.
– Peter K.
Nov 19, 2021 at 21:34
• Sorry, this makes no sense whatsoever. SNR is signal energy divided by noise energy. You are dividing the mean by the standard deviation. Whatever that is, it's NOT the SNR. Can you cite where you came across this definition of SNR ? Nov 19, 2021 at 21:34
• Very nice link, but I cannot find the place you reference. In any event, using SNR as mean/standard deviation is not useful in many situations. For a sine wave, you have plenty of viable options, e.g., peak magnitude/standard deviation. And the power ratio is fine. I will look through chapter 8 in your linked reference.
– Ed V
Nov 19, 2021 at 22:15
• That's not on the link you gave (and I'm not sure what you mean by "page 17" on a web link?). I did eventually find it here. Regardless, it's wrong.
– Peter K.
Nov 19, 2021 at 22:18
• I found it at the end of Chapter 2 in the linked book. @PeterK. is right about that definition being wrong, but there are specific cases where it can work. For example, suppose you have a rectangular pulse and the pulse has amplitude A, with the baseline being zero. Also suppose there is additive white noise on the pulse. So you could use the mean of some measurements of the noisy pulse amplitude and the standard deviation of those (or the baseline).
– Ed V
Nov 19, 2021 at 22:30

The good question here is then how do we best estimate SNR when we have a general capture of signal plus noise? For this I use the correlation coefficient and then from that we can get a very good estimate of the SNR. We correlate the signal+noise waveform to a known good reference of the signal alone and normalize by the standard deviation of both (this is the Pearson Correlation Coefficient) to get $$\rho$$, and then we can relate $$\rho$$ to SNR as I already detailed in the following posts: