# Error rate in AWGN: why mean=0, variance = No/2 ?

Status
Not open for further replies.

#### mazdaspring I am trying to understand how to do matlab on error rate in AWGN. However I am not clear on some parts below.

1 Why mean is 0 and why variance=No/2 where are they from? is it theory or what?

And I need to add noise to the signal. What is the noise equation in theory and how do you write
noise equation in matlab.

Thank you.

#### puripong

##### Member level 2 AWGN is additive white Gaussian noise.
Its mean is zero according to Gaussian distribution.

No/2 is noise power
I'm not sure about actual meaning of No/2 but I think
the power of real signal spreads over negative and positive frequency.
So, No/2 stands for two-sided power spectral density.

In Matab,
function randn is used to generate Gaussian distributed random value with zero mean and unit variance

Last edited:

#### mazdaspring In Matab,
function randn is used to generate Gaussian distributed random value with zero mean and unit variance

Thank you so much. That's quite clear to me. Can you explain to me further please. what different between rand and randn?
So when I do matlab for AWGN I have to use randn instead of rand?

Also...I see some people's code....their noise in matlab is 1/(squareroot2 x [rand(1,N)+j randn(1,N)])
where is this come from? and why in the [] ....real value use rand and imaginary use randn?

Thank you so much in advance.

#### puripong

##### Member level 2 Function rand is used to generate uniformly-distributed random values
whereas function randn is for Gaussian-distributed random values.

I think this term [rand(1,N)+j randn(1,N)]) is complex Gaussian random value
So the variance (you may think it as power) of its is equal to 2

In matlab, you can easily check variance of variable X
X = randn(1,N)
by typing
var(X)

If N is large, var(X) is aprrox. 1

and then you can further check the var(X+Y) = 2
where X = randn(1,N) and Y = randn(1,N)

To normalize energy of [rand(1,N)+j randn(1,N)]) to 1, we simply multiply with 1/sqrt(2)

Hope this helps

#### ninju

##### Full Member level 3 randn produces all positive numbers. So, it can not be 0 mean.

to add awgn to a signal, use awgn(signal, snr);

r = a + (b-a).*rand(100,1);

• Darrier

### Darrier

Points: 2

#### Max Planck

##### Junior Member level 3 Can you explain to me further please. what different between rand and randn?
The difference concerns distributions of random variables generated by these functions. rand() generates random elements with unit distribution whereas randn() with normal distribution.

#### mazdaspring randn produces all positive numbers. So, it can not be 0 mean.

to add awgn to a signal, use awgn(signal, snr);

r = a + (b-a).*rand(100,1);

What is a and b?

By the way, thank you for all of you. I understand it now about rand, randn

#### ninju

##### Full Member level 3 sorry,

a is the lower limit and b isthe upper limit of the numbers you expect.

#### prank

##### Newbie level 4 friends can you tell me about what is real valued gaussian distribution noise ??. and how can it be generated

#### in8214

##### Newbie level 4 Hi Prank
Say you want to add gaussain on the following 10 bits of BPSK modulated data

ModulatedData= randint(1,10,[1 0]);

And Say EbNo= 4dB
this is how you can calculated Real and Img part of noise

EbNo_lin=10.^(EbNo/10); % Calculate Linear value of EbNo

No= 1/EbNo_lin; %Calculate Noise Power Assuming Eb=1

NI=sqrt(No/2)*randn(1,length(ModulatedData));
NQ=sqrt(No/2)*randn(1,length(ModulatedData));
N=NI+j*NQ ; %Generate complex AWGN

#### Ahmed Alaa

##### Full Member level 5 No is the noise power density over a BW B, and because noise spectrum is in the +ve and -ve frequencies the amplitude is No/2 in a double-sided spectrum. Zero mean comes from the fact that all noise samples are independent and the whole noise signal is uncorrelated, so the noise signal isn't biased neither to the + nor - amplitudes.

Status
Not open for further replies.