# AWGN and Rayleigh fading in slow flat fading channels in MATLAB

I wanted to add Additive White Gaussian Noise (AWGN) and involve effect of slow flat fading on my transmitted signal in Matlab.

I created noise with zero mean and variance of one by

awgn_noise = random('norm',0,1,1,NoOfSamples);


Then I created Rayleigh fading by

rayleigh = sqrt( (random('norm',0,1))^2 + (random('norm',0,1))^2 );


As far as I understand, the rayleigh values will attenuate the whole signal while gaussian noise values will be added to each sample of transmitted signal as:

received_signal = (transmitted_signal*rayleigh) + awgn_noise;


Am I doing it in a right way?

As I described in this answer, it is generally assumed in the Rayleigh fading model that the energy is conserved on average (i.e. that the fading coefficient $R$ is such that $E\left\{R^2\right\} = 1$). As a result you would need to generate the Rayleigh distribution from two normal distribution with standard deviation of $1/\sqrt{2}$ (instead of with unit standard deviation). This can be achieved with:

rayleigh = sqrt( (random('norm',0,1/sqrt(2)))^2 + (random('norm',0,1/sqrt(2)))^2 );


or alternatively, since you are already using random from the statistics toolbox, with:

rayleigh = random('Rayleigh',1/sqrt(2));


Other than that, the expressions you have properly represent a slow flat Rayleigh fading channel for the transmission of a one-dimensional signal (such as BPSK, M-PAM, ...)

• Thanks a lot for the answer. The answer you referred really helped me already while writing these equations. Yes, I am using BPSK signal but I didn't get why the energy is conserved on average i.e. 1 for Rayleigh fading? – Rok Dec 22 '15 at 13:02
• In your second last line "(e.g. lossy channel)", were you supposed to write "(e.g. lossless channel)"? It is making the definition vague. – Rok Dec 23 '15 at 14:06
• This fading model comes about to account for situations where there is a large number of scatterers, but ultimately the energy that is scattered has to come from somewhere. E{R^2}=1 means that all the transmitted power eventually reaches the receiver (lossless channel). Also, you can see this as the model normalization condition: once you have the performance of the system for E{R^2}=1, you can get it's performance for other values of E{R^2} (e.g. lossy channel) by correspondingly adjusting the SNR. – SleuthEye Dec 23 '15 at 14:10
• @Rok I meant lossless channel, but I didn't type it at the right place (now it should be). Thanks! – SleuthEye Dec 23 '15 at 14:12