KEMBAR78
Signal-to-Noise Ratio Explained | PDF | Signal To Noise Ratio | Applied Mathematics
0% found this document useful (0 votes)
59 views2 pages

Signal-to-Noise Ratio Explained

The document discusses different definitions of signal-to-noise ratio (SNR) and provides a code sample for adding noise to a signal with a desired SNR. It defines SNR as the power of the clean signal over the power of additive noise. The code takes in a signal and desired SNR, computes the necessary scaling factor, and returns the noisy signal and added noise.

Uploaded by

fadhlanakmal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
59 views2 pages

Signal-to-Noise Ratio Explained

The document discusses different definitions of signal-to-noise ratio (SNR) and provides a code sample for adding noise to a signal with a desired SNR. It defines SNR as the power of the clean signal over the power of additive noise. The code takes in a signal and desired SNR, computes the necessary scaling factor, and returns the noisy signal and added noise.

Uploaded by

fadhlanakmal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Adding noise with a desired signal-to-noise ratio

Mauricio D Sacchi
Signal Analysis and Imaging Group, University of Alberta

There is often confusion between different definitions of signal-to-noise ratio SNR. In


order to communicate your results, I suggest to be clear and adopt one definition. For
instance,
Power of the clean signal Ps
SNR = =
Power of the additive noise Pn
The observed signal is dk , k = 1 . . . N . The signal can be written as a vector of length N
that we call d. The clean signal is given by sk , k = 1 . . . N and it can also be expressed as
a vector of length N denoted by s. Our task is to add noise to the data
dk = sk + α nk ,
or
d = s + αn
where α is a scalar used to yield a predefined SNR. We define the power of the signal and
noise via the following expressions
N
1 X 2
Ps = sk
N
k=1
N
1 X
Pn = (α nk )2 .
N
k=1
Now, we recall our definition of SNR:
PN
k=1 s2k
SNR = N
2 2
P
α k=1 nk
Then, we select the value α that yields the desired SNR
PN 2
2 k=1 sk
α =
SNR N 2
P
k=1 nk
ksk22
=
SNR knk22

1
A simple code for adding noise to a signal is provided in the following function:

function Add_Noise(s, SNR)

# Compute d = s + n such that SNR = Ps/Pn


#
# s: Input signal
# SNR: Desired signal-to-noise ratio
# d: Output signal

n = randn(size(s))
Es = sum(s[:].^2)
En = sum(n[:].^2)
alpha = sqrt(Es/(SNR*En))
d = s+alpha*n
return d,alpha*n

end

Often SNR is given in decibels (dB). In this case

SNRdB = 10 log10 (SNR) .

You can convert SNRdB to SNR and then use the code above. If SNRdB = 0, SNR=1 or
in other words, the power of the noise is equal to the power of the clean signal.
Notice that Pn is also an estimator of the variance of the noise σ 2 . Therefore, one could
have also defined the signal-to-noise ratio as follows

Ps
SNR = .
σ2

You might also like