# Mathematical Background of the Noise Power Measurement with snr Function

조회 수: 9 (최근 30일)
harun 2023년 3월 25일
댓글: harun 2023년 4월 6일
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.

댓글을 달려면 로그인하십시오.

### 채택된 답변

Meet 2023년 4월 5일
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이전 댓글 -1개 표시이전 댓글 -1개 숨기기
harun 2023년 4월 6일
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.

댓글을 달려면 로그인하십시오.

### 카테고리

Help CenterFile Exchange에서 Fast Fourier Transforms에 대해 자세히 알아보기

### Community Treasure Hunt

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

Start Hunting!

Translated by