Mathematical Background of the Noise Power Measurement with snr Function

28 views (last 30 days)
Hi,
I am using MATLAB's snr (signal-to-noise ratio) function in my project to measure the noise power of a sensor signal. I give the one-sided PSD of the signal to the snr function and use the second output of it, which is the noise power.
The only explanation of the noise power output is this: "Total noise power of the nonharmonic components of the input signal, returned as a real-valued scalar."
I need to give the mathematical explanation of this calculation in the paper and I want to calculate the noise power without using snr (if possible) because I am asked to do this.
I tried to use a highpass filter to remove non-noise parts of the signal and then compute the RMS of the signal to match with the snr output. There is a big similarity between RMS and SNR outputs but they are not matching completely.
Thank you for your help.

Accepted Answer

Meet
Meet on 5 Apr 2023
The documentation page of the snr function provides the following mathematical background of the algorithm used in function:
"When given time-domain input, snr performs a periodogram using a Kaiser window with large sidelobe attenuation. To find the fundamental frequency, the algorithm searches the periodogram for the largest nonzero spectral component. It then computes the central moment of all adjacent bins that decrease monotonically away from the maximum. To be detectable, the fundamental should be at least in the second frequency bin. Higher harmonics are at integer multiples of the fundamental frequency. If a harmonic lies within the monotonically decreasing region in the neighborhood of another, its power is considered to belong to the larger harmonic. This larger harmonic may or may not be the fundamental.
The function estimates a noise level using the median power in the regions containing only noise. The DC component is excluded from the calculation. The noise at each point is the estimated level or the ordinate of the point, whichever is smaller. The noise is then subtracted from the values of the signal and the harmonics.
snr fails if the fundamental is not the highest spectral component in the signal."
You can find this information in the "More About" section of Signal-to-noise ratio - MATLAB snr (mathworks.com).
  1 Comment
harun
harun on 6 Apr 2023
Thank you for your response, Meet.
Along with the information you emphasized, I examined the source code of the snr function. It was very useful to examine the psdSNR and computeSNR functions in the snr.m file. I realized that the parts that were bothering me were done using the signal.internal.getToneFromPSD function frequently used in computeSNR. Therefore, I think I have received the answers to my questions.
Have a nice day.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!