# SNR and noise in Simulations

I've always taken the definition of noise and SNR for granted in doing BER simulations in an AWGN channel. I would usually use the AWGN noise function and make a loop with varying SNR values. However, I am looking at other coding examples and I found this:

sig= 1/sqrt(2*SNR);
n1 = randn(NN,1);
noise1=sig*n1;
N0=2*(sig.^2);

• Is this the definition embedded in the AWGN function in MATLAB?
• If not, then what is it and why is sig defined this way and what is it in relation to N0?
• I don't understand what you're asking. Your first question can be answered by looking at Matlab's code for that function (if available). Your second question seems to be about interpreting some random code you found somewhere and is impossible to answer without context and a more specific question. – MBaz May 15 '16 at 17:33

The AWGN variance is:

sig= 1/sqrt(2*SNR);


Then, you define a random sequence:

n1 = randn(NN,1);


So the noise signal is:

noise1=sig*n1;


And the PSD is:

N0=2*(sig.^2);