# Adding White Gaussian noise to a signal

Status
Not open for further replies.

#### charly87

##### Newbie level 5
n = 1/sqrt(2)*[randn(1,N) + j*randn(1,N)].

10.^(-SNR_dB(ii)/20)*n

what does the above two equations represeent? i have seen quite a lot to define noise but is it exactly they means?

thanks

the first equation represents complex baseband noise of variance = 1.
In the second equation, the premultiplying term to noise is square root of variance (if signal power =1) by the formula.. SNR_dB=10*log(1/noise_variance)

HI! why is the noise variance=1? normally the variance of noise will No/2. also in the second equation, why -SNR and why divide by 20.

thanks

randn function is standard gaussian which has mean=0 and variance= 1, so when you calculate the overall variance of n it wiil be 1.
and " -SNR and why divide by 20." is answered by the equation
noise_standard_deviation=10.^(-SNR_dB/20)
because
SNR_dB=10*log(base 10)(1/noise_variance).
standard deviation= sqrt(variance)

• charly87

### charly87

Points: 2
Hi Pulkit, why would we want the noise variance to be equal to 1. also have ever used the awgn function in matlab? when i used the function, my results are not correct but when using the equation u explained, my results are fine even though i don,t quite get why it works. regards

Hi Pulkit, why is that the rayleigh fading also has the same equation as n which u said represent complex baseband noise. thanks

- - - Updated - - -

h = 1/sqrt(2)*[randn(1,N) + j*randn(1,N)]; % Rayleigh channel

why this equation for rayleigh fading?

its not necessary that we want noise variance equal to one as you are changing your noise variance by the equation
10.^(-SNR_dB/20)*n.. where the premultiplying term to n is sqrt(noise variance) as i told earlier...

for h = 1/sqrt(2)*[randn(1,N) + j*randn(1,N)]; % Rayleigh channel

the magnitude of this complex sum of two gaussian signals is rayleigh distributed and phase is uniformly distributed..
Rayleigh fading channel means magnitude is rayleigh distributed and phase is uniformly distributed.

V
Points: 2
Hi Pulkit, thanks for ur help and time, i am grateful.

hi pulkit! have u ever came across channel estimation in ofdm?

thanks

do u have the matlab code for gaussian noise generation without wgn or awgn functions.....i would like to generate statistical noise and i think the above functions are related to random noise....that is why i asked for a code other than the functions...

Thank you...

you can generate gaussain noise by using the command 'randn'..
search for its help in matlab command window

Hi Mr. Pulkit,,,

but 'randn' generates random noise na...? i wanna get statistical noise...
so will it be better to use this equation which creates gaussian distribution..?

noise=(sqrt(1/(((2*pi)^N)*det(Q))))*(exp((-x'*inv(Q)*x)/2));

where Q is the noise covariance matrix...

- - - Updated - - -

Do you have any idea about what the below expression means...? I read that it generates same random noise everytime you run the program...but what is the signaficance with the '0' in this expression?

randn('state',0);

randn('state',0); initiate the random number generator

ok mohammed...thank you..

So can we use randn('state',2) and so...if yes wht diz 0,1,2 etc.. .. .signify?
whn i use this, am getting same random numbers generated eveytime i run the code...what is its relation with the command??

hi Lekshmi B S ,
0,1,2 etc.. represent to the initial value of random number genrator every time you repeat identifing the generator you will take the same answer like...
>>randn('state',2)
>>a=randn(1)
a=1.7491
>>a=randn(1)
a=0.1326
>>randn('state',2).................................% define the initial value of random number genrato again
>>a=randn(1)

• Lekshmi B S

### Lekshmi B S

Points: 2
ok...thank you mohammed for your valuable help.... • mohammed.anpr

Points: 2