---
+ Post New Thread
Results 1 to 17 of 17
  1. #1
    Full Member level 3
    Points: 2,193, Level: 10

    Join Date
    Apr 2007
    Posts
    159
    Helped
    6 / 6
    Points
    2,193
    Level
    10

    AWGN Channel

    Hello,

    In AWGN channel, how is white noise generated using MATLAB? I mean, I have a code at hand, but I did not understand it. For example, it says somewhere in the code:

    y = s + 10^(-Eb_N0_dB(ii)/20)*n;

    where s is the transmitted sequence, Eb_N0_dB is the SNR, and n is the additive white noise. Can anyone explain to me the noise term, please? Why do we use the expression 10^(-Eb_N0_dB(ii)/20)*n?

    Regards

  2. #2
    Full Member level 3
    Points: 2,193, Level: 10

    Join Date
    Apr 2007
    Posts
    159
    Helped
    6 / 6
    Points
    2,193
    Level
    10

    Re: AWGN Channel

    Quote Originally Posted by mathuranathan
    The above code attempts to add noise (term - '10^(-Eb_N0_dB(ii)/20)*n') to a signal (term - 's').

    the term y contains signal+noise.

    The above code generates a noise term with required signal to noise ratio. Eb_N0_dB(ii) is a function that generates the scaling factor to generate required signal to noise ratio.

    here ii is the input argument specifying the SNR in dB

    For more details von how to generate noise for required SNR
    http://gaussianwaves.blogspot.com/20...form-with.html

    Regards
    Mathuranathan
    Thank you Mathuranathan for replying.

    Actually, I still do not get why we use the expression 10^(-Eb_N0_dB(ii)/20)*n for the noise. Anyway, from the link you gave me, I found a built-in function in MATLAB which is AWGN() function that adds noise depending on the SNR. I tried it as in the following code:

    Code:
    function BER
    clear;
    N=10^6;
    SNRdB=[-3:10];
    SNR=10.^(SNRdB/10);
    b=rand(1,N)>0.5;
    s=2*b-1;
    for ii=1:length(SNRdB)
        y=awgn(s,SNRdB(ii),'measured');
        bHat=real(y)>0;
        Diff=xor(bHat,b);
        nErr(ii)=length(find(Diff));
    end
    
    simBER=nErr/N;
    theoryBER=0.5*erfc(sqrt(SNR));
    semilogy(SNRdB,simBER,'k*',SNRdB,theoryBER,'bx');
    legend('Simualtion','Theory');
    but there is a shift between the theoritical and simulated results. Why is that? Is there anything wrong in the code?

    Thanks in advance



  3. #3
    Full Member level 3
    Points: 2,193, Level: 10

    Join Date
    Apr 2007
    Posts
    159
    Helped
    6 / 6
    Points
    2,193
    Level
    10

    Re: AWGN Channel

    Quote Originally Posted by mathuranathan
    Hi
    There is nothing wrong with the code.
    The simulated value may be different from the theoretical value. The theoretical result uses a well defined equation whereas the simulated result is obtained from a set of generated inputs. Always the simulated result will show deviation from the theoretical result.

    Regards
    Mathuranathan
    But when I replaced the addition of additive white Gaussian noise line y=awgn(s,SNRdB(ii),'measured'); by y = s + 10^(-Eb_N0_dB(ii)/20)*n; both results (the simulated and theoritical) collide. It does not make sense!!!

    Regards



  4. #4
    Full Member level 3
    Points: 2,193, Level: 10

    Join Date
    Apr 2007
    Posts
    159
    Helped
    6 / 6
    Points
    2,193
    Level
    10

    Re: AWGN Channel

    Quote Originally Posted by mathuranathan
    Can u plot the graph in both cases to understand the situation ?

    Regards
    Mathuranathan


    1 members found this post helpful.

    •   Alt8th April 2010, 11:25

      advertising

        
       

  5. #5
    Full Member level 3
    Points: 2,193, Level: 10

    Join Date
    Apr 2007
    Posts
    159
    Helped
    6 / 6
    Points
    2,193
    Level
    10

    Re: AWGN Channel

    Quote Originally Posted by mathuranathan
    Hi saeddawoud
    The term 10^(-Eb_N0_dB(ii)/20)*n is derived as follows

    For AWGN channel with noise power spectral density N0 the standard deviation of noise is given by

    σ = √(N0/2) --------> (1)

    For BPSK the symbol energies are assumed to be normalized to 1 (since 0 represented by -1 and 1 represented by +1 )

    Given Eb_N0_dB has to be converted to linear scale first
    Eb/N0 = 10 ^(Eb_N0_dB/10); --->(2)

    Now we need to find the sigma of noise according to the desired Eb/No ratio

    if Eb=1 in (2)
    then
    1/N0 = 10 ^(Eb_N0_dB/10)
    => N0 = 1/(10 ^(Eb_N0_dB/10) ) ---> (3)

    (3) in (1)
    σ = √(1/(10 ^(Eb_N0_dB/10) )/2)
    or
    σ =1/√2 * 1/(10 ^(Eb_N0_dB/20)

    this is how the term is derived

    The problem here is not due to equation , it is due the way the awgn function is used.

    The awgn measures the SNR (signal power/noise power) (note: everything in terms of power) but Eb/N0 is in terms of energy

    For proper result if you want to use awgn function , translate the Eb/N0 to required SNR (in power) and then use the function

    Regards
    Mathuranathan
    Ok, it is clear now. One last thing, why we multiply the variance by the noise in the term 10^(-Eb_N0_dB(ii)/20)*n?

    Thanks in advance



  6. #6
    Full Member level 3
    Points: 2,193, Level: 10

    Join Date
    Apr 2007
    Posts
    159
    Helped
    6 / 6
    Points
    2,193
    Level
    10

    Re: AWGN Channel

    I have noticed that, when I set the range of errors from 10^-7 up to 0.5, the simulation curve stopped on 10^-6. Why is that?



  7. #7
    Full Member level 3
    Points: 2,193, Level: 10

    Join Date
    Apr 2007
    Posts
    159
    Helped
    6 / 6
    Points
    2,193
    Level
    10

    Re: AWGN Channel - generating noise for required SNR

    I think it is clear now the concept of adding AWGN to the transmitted signal over AWGN channel. Let me summarize:

    For a specific SNR we need to add a noise term to the transmitted symbol such that the SNR is as specified, i.e.: if the SNR(dB)=15, we need to add a noise term such that the SNR(dB)=15 dB. To do this, we assume that the signal energy is unity (Why?), and then:

    Code:
    y=s+10.^(-15/20)*n
    where y is the received signal, s is the transmitted signal, and n is the additive noise generated using randn function that generates normal RVs with zero mean and unity variance. the SNR (linear) of the above equation is:

    . But, is the assumption that the energy of the signal = 1 is valid?

    Now, let us turn to the multipath fading channles. In this case the receiced signal will be:

    Code:
    y=h*s+10.^(-15/20)*n
    the SNR in this case is:



    Shall we assume that the numerator is unity? I.e.: |h|^2*Es =1? Why?

    Thanks in advance
    Last edited by BlackMamba; 27th August 2010 at 14:19.



  8. #8
    Full Member level 3
    Points: 2,193, Level: 10

    Join Date
    Apr 2007
    Posts
    159
    Helped
    6 / 6
    Points
    2,193
    Level
    10

    Re: AWGN Channel

    Quote Originally Posted by mathuranathan
    ...
    For proper result if you want to use awgn function , translate the Eb/N0 to required SNR (in power) and then use the function
    ...
    How can I do that? I want to use the awgn function in my codes.

    Thanks in advance



    •   Alt20th April 2010, 16:00

      advertising

        
       

  9. #9
    Full Member level 3
    Points: 2,193, Level: 10

    Join Date
    Apr 2007
    Posts
    159
    Helped
    6 / 6
    Points
    2,193
    Level
    10

    Re: AWGN Channel - generating noise for required SNR

    Quote Originally Posted by mathuranathan
    S/N = Eb/N0 * R/B
    where R is the data rate and B is the bandwidth of the channel.

    here S/N is in terms of power (signal power / noise power).
    Thank you very much for replying, but then, we need to specify the data rate and the bandwidth of the channel. How can we know the most appropriate values for these variables? and how will they affect the final result? Can you give me a simple example, please?

    Regards



  10. #10
    Newbie level 4
    Points: 203, Level: 2

    Join Date
    Dec 2011
    Posts
    6
    Helped
    0 / 0
    Points
    203
    Level
    2

    Re: AWGN Channel - generating noise for required SNR

    Quote Originally Posted by saeddawoud View Post
    Thank you very much for replying, but then, we need to specify the data rate and the bandwidth of the channel. How can we know the most appropriate values for these variables? and how will they affect the final result? Can you give me a simple example, please?

    Regards
    Is y=s-(20 log⁡(SNR)*n) the same with y = s + 10^(-Eb_N0_dB(ii)/20)*n?
    please reply me as soon as possible.

    ---------- Post added at 05:28 ---------- Previous post was at 05:21 ----------

    Quote Originally Posted by saeddawoud View Post
    Hello,

    In AWGN channel, how is white noise generated using MATLAB? I mean, I have a code at hand, but I did not understand it. For example, it says somewhere in the code:

    y = s + 10^(-Eb_N0_dB(ii)/20)*n;

    where s is the transmitted sequence, Eb_N0_dB is the SNR, and n is the additive white noise. Can anyone explain to me the noise term, please? Why do we use the expression 10^(-Eb_N0_dB(ii)/20)*n?

    Regards
    Is y=s-(20 log⁡(SNR)*n) the same with y = s + 10^(-Eb_N0_dB(ii)/20)*n?
    please reply me as soon as possible. And then, i would like to know the value of n?



  11. #11
    Full Member level 5
    Points: 1,938, Level: 10

    Join Date
    Jan 2011
    Posts
    281
    Helped
    29 / 29
    Points
    1,938
    Level
    10

    Re: AWGN Channel - generating noise for required SNR

    Is SNR here in dB or linear?



  12. #12
    Newbie level 4
    Points: 203, Level: 2

    Join Date
    Dec 2011
    Posts
    6
    Helped
    0 / 0
    Points
    203
    Level
    2

    Re: AWGN Channel - generating noise for required SNR

    Quote Originally Posted by David83 View Post
    Is SNR here in dB or linear?
    i think it is in dB!



  13. #13
    Full Member level 5
    Points: 1,938, Level: 10

    Join Date
    Jan 2011
    Posts
    281
    Helped
    29 / 29
    Points
    1,938
    Level
    10

    Re: AWGN Channel - generating noise for required SNR

    Quote Originally Posted by rhi zan View Post
    i think it is in dB!
    In the equation y = s + 10^(-Eb_N0_dB(ii)/20)*n, EB_N0_dB is the SNR is dB, and it is correct. Why do you need another formula? Your formula is not right. An alternative will be:

    y=s+(1/sqrt(SNR))*n, where SNR here is in linear scale.


    1 members found this post helpful.

  14. #14
    Newbie level 4
    Points: 203, Level: 2

    Join Date
    Dec 2011
    Posts
    6
    Helped
    0 / 0
    Points
    203
    Level
    2

    Re: AWGN Channel - generating noise for required SNR

    Thank u for ur reply!! but i need to change a little bit. how can i change the equation, y = s + 10^(-Eb_N0_dB(ii)/20)*n to another way? Please tell me! i am not so clear ! Thank u! Is this equation y=s+(1/sqrt(SNR))*n right and same with y = s + 10^(-Eb_N0_dB(ii)/20)*n?



  15. #15
    Full Member level 5
    Points: 1,938, Level: 10

    Join Date
    Jan 2011
    Posts
    281
    Helped
    29 / 29
    Points
    1,938
    Level
    10

    Re: AWGN Channel - generating noise for required SNR

    Quote Originally Posted by rhi zan View Post
    Thank u for ur reply!! but i need to change a little bit. how can i change the equation, y = s + 10^(-Eb_N0_dB(ii)/20)*n to another way? Please tell me! i am not so clear ! Thank u! Is this equation y=s+(1/sqrt(SNR))*n right and same with y = s + 10^(-Eb_N0_dB(ii)/20)*n?
    It is correct as long as SNR is in Linear scale, and s is BPSK. Do not forget to write SNR(ii) because SNR will be a vector.


    1 members found this post helpful.

  16. #16
    Newbie level 6
    Points: 767, Level: 6

    Join Date
    Jun 2009
    Location
    Egypt
    Posts
    14
    Helped
    1 / 1
    Points
    767
    Level
    6

    Re: AWGN Channel - generating noise for required SNR

    How to include the path loss exponent and the distance between the source & destination in the channel H???



  17. #17
    Newbie level 5
    Points: 759, Level: 6

    Join Date
    May 2010
    Location
    assa
    Posts
    10
    Helped
    1 / 1
    Points
    759
    Level
    6

    Re: AWGN Channel - generating noise for required SNR

    i thinck it will be y=s+(1/sqrt(2*SNR))*n not ........ y=s+(1/sqrt(SNR))*n
    because σ = √(N0/2)



+ Post New Thread
Please login