I defined the SNR as follows:

$$\rm SNR = \frac{\text{Signal power density}}{\text{Noise power density}}$$

Given noise-free signal, I added the noise to this signal by using the formula above. Now, I am looking for a way to verify if the obtained SNR of the noisy signal is equal to the SNR value that I set when I generated the noise.

Thanks in advance!

  • 1
    $\begingroup$ It depends on what are your signal and noise and how you generate/add them. $\endgroup$
    – AlexTP
    Aug 27, 2020 at 15:00
  • $\begingroup$ If you want to verify it for testing purposes, I would calculate all the gains for both signals, but instead of adding the time domain signals, I would concatenate them. Then you can verify if levels of both are correct. $\endgroup$
    – jojeck
    Aug 27, 2020 at 17:15

2 Answers 2


Here is a common/straight-forward way using the discrete time domain samples. If you have the noise free signal, $x[n]$, and you created a noise signal, $w[n]$, then you can calculate the SNR by using the formula: $$\hat{\text{SNR}}=\frac{\sum_n |x[n]|^2}{\sum_n |w[n]|^2}$$


An unstated assumption above is that $\mathbb{E}\big[x[n]\big]=\mathbb{E}\big[w[n] \big]=0$. In general, you'd use the variance not the sum of squared values, as to take care the possible non-zero means:



Assuming you are simulating everything and the expected values of both the signal $x[n]$ and the noise $w[n]$are both $0$, you can calculate the SNR by dividing their mean squared sum and extracting $20$ times the logarithm of the result, as in:

$$SNR=10 log\left(\frac{\sum_{k=0}^N|x[k]|^2}{\sum_{k=0}^N|w[k]|^2}\right)$$

The $log$ is there in order to convert the units into %db$ which is the convention on measuring SNR.

After calculating the existing SNR, you can set the required SNR. This is usually done by setting the gain on the noise $w[n]$, because when we simulate we assume the signal is given. Let the required SNR be denoted by $\hat{SNR}$ and a gain $A$ on $w[n]$:

$$\hat{SNR}=10 log\left(\frac{\sum_{k=0}^N|x[k]|^2}{\sum_{k=0}^N|Aw[k]|^2}\right)=10 log\left(\frac{\sum_{k=0}^N|x[k]|^2}{A^2\sum_{k=0}^N|w[k]|^2}\right)$$ $$\hat{SNR}=10 log\left(\frac{\sum_{k=0}^N|x[k]|^2}{A^2\sum_{k=0}^N|w[k]|^2}\right)-10log(A^2)=SNR-20log(A)$$ $$A=10^{\frac{SNR-\hat{SNR}}{20}}$$

After calculating $A$, you can check for the requested SNR by:

$$\hat{SNR}=10 log\left(\frac{\sum_{k=0}^N|x[k]|^2}{\sum_{k=0}^N|Aw[k]|^2}\right)$$

which is quite redundant. You can now create your results by adding them together using $y[n]=x[n]+Aw[n]$. There is no way to test the SNR of $y[n]$ without using either $x[n]$ or $w[n]$.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.