SNR and noise in Simulations
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);


Have a look to this example for more info.