0
$\begingroup$

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!

$\endgroup$
2
  • 1
    $\begingroup$ It depends on what are your signal and noise and how you generate/add them. $\endgroup$
    – AlexTP
    Aug 27 '20 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$
    – jojek
    Aug 27 '20 at 17:15
1
$\begingroup$

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}$$

Edit

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:

$$\hat{\text{SNR}}=\frac{\text{var}(x[n])}{\text{var}(w[n])}$$

$\endgroup$
0
$\begingroup$

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]$.

$\endgroup$
-4
$\begingroup$

On SNR wikipedia page, there is a section "Alternative definition".

SNR = Mean^2 / Standard_deviation^2

$\endgroup$
8
  • $\begingroup$ Could you be more specific? Mean of what? And standard deviation of what? $\endgroup$
    – Engineer
    Aug 27 '20 at 14:43
  • 2
    $\begingroup$ -1 because the definition is not applicable to this problem (according to the article it is in relation to image processing) and secondly the OP will not have access to the true mean and standard deviation but is looking for some way given the signal values how to verify $\endgroup$
    – Engineer
    Aug 27 '20 at 14:47
  • 2
    $\begingroup$ @Engineer the problem is not that the signal isn't an image, but that this definition assumes a lot about the signal (namely, it being constant) that isn't given. $\endgroup$ Aug 27 '20 at 14:56
  • $\begingroup$ @MarcusMüller thanks, that makes more sense than what I said $\endgroup$
    – Engineer
    Aug 27 '20 at 18:25
  • 2
    $\begingroup$ @gotchi85 again, this formula only works if your signal of interest is a constant. That has nothing to do with whether it's an image, a radio signal, or anything else. There's no "plug and play" formulas, anywhere, you always need to check whether the assumptions of your formula are met. If you mention a formula to someone else, it's your duty to clearly state these assumptions! $\endgroup$ Aug 28 '20 at 8:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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