There are a number of possible conventions used to define a s/n ratio, a common one being based on the notion of signal and noise power. If the total power of the spectrum is p
and the noise power is np
, then the signal-to-noise can be written as snr = p - np
, when the power is in dB units, or snr = p/np
, when the power is in linear units.
The MATLAB (and Octave equivalent) function awgn
adds (white Gaussian) noise to an input data array to the desired final s/n power level, specified by default in dB. The function awgn
uses another function wgn
to generate an array representing the noise at a desired noise power level. The noise is sampled from a Gaussian distribution (it is not rescaled to make the variance of the points in the array equal exactly the desired noise power level, as some suggest you do; do not rescale the noise: if you rescale the points sampled from the noise distribution, then the points will (obviously) not necessarily reflect the desired noise distribution or the desired power level!). You can specify the amount of noise to add to your data via awgn
in a number of non-default ways, for instance: a) by specifying the power of the input data (the default is 0 dB), or b) by asking the routine to compute the power of the input data using the formula p = var(data,1)
, where var(...,1) implies computation of the population variance. In either case the routine computes the required noise power level using the formula np = p-snr
(in dB).
The excellent MATLAB documentation provides a good description of the awgn routine.
SNR
is just the ratio between the average value of the signalµ
and the standard deviation of this signalσ
. So knowing the SNR you just have to evaluateµ
andσ
will beµ/SNR
. Why do you say "It is mentioned" ? Is this your homework ? – Ratbert