# Simulation of Rayleigh Fading ( Clarke’s Model – sum of sinusoids method)

(6 votes, average: 3.83 out of 5)

A multipath fading channel  can be modeled as a FIR (Finite Impulse Response) filter with the following impulse response.

$$h( \tau ; t ) = h_{0}(t) \delta ( \tau – \tau_{0}(t)) + h_{1}(t) \delta ( \tau – \tau_{1}(t)) + . . . + h_{L-1}(t) \delta ( \tau – \tau_{L-1}(t))$$

where h(τ,t) is the time varying impulse response of the multipath fading channel having L multipaths and hi(t) and τi(t) denote the time varying complex gain and excess delay of the i-th path. The above mentioned impulse response can be implemented as a FIR filter as shown below :

The channel under consideration can be modeled as a multipath fading channel in which the impulse response may follow distributions like Rayleigh distribution ( in which there is no Line of Sight (LOS) ray between transmitter and receiver) or as Rician distribution ( dominant LOS path exist between transmitter and receiver), Nagami distribution, Weibull distribution etc.

Different methods of simulation techniques were proposed to simulate/model multipath channels. Some of the models include clarke’s reference model, Jake’s model, Young’s model , filtered gaussian noise model etc.

A Rayleigh fading channel (flat fading channel) is considered in this text.For simplicity we fix the excess delays τi(t) in the above equation and we generate hi(t) that follows Rayleigh distribution. In this simulation Clarke’s Rayleigh fading model is used. This model is also called mathematical reference model and is commonly considered as a computationally inefficient model compared to Jake’s Rayleigh Fading simulator.

### Theory of Rayleigh Fading:

Lets denote the complex impulse response h(t) of the flat fading channel as follows :

$$h(t) = h_{I}(t) + jh_{Q}(t)$$

where hI(t) and hQ(t) are zero mean gaussian distributed. Therefore the fading envelope is Rayleigh distributed and is given by

$$\left |h(t) \right | = \sqrt{\left |h_{I}(t) \right |^2 + \left |h_{Q}(t) \right |^2}$$

The probability density function (Rayleigh distribution) of the above mentioned amplitude response is given by

$$f(z)=\frac{2z}{\sigma ^{2}}e^{-\frac{z^{2}}{\sigma ^{2}}} \\ where \; \sigma ^{2} = E\left ( \left | h(t) \right |^{2} \right )$$

We will use the Clarke’s Rayleigh Fading model (given below) and check the statistical properties of the random process generated by the model against the statistical properties of Rayleigh distribution (given above).

### Clarke’s Rayleigh Fading model:

The random process of flat Rayleigh fading with M multipaths can be simulated with the sum-of-sinusoid method described as

$latex \begin{matrix} h_{I}(nT_{s})=\frac{1}{\sqrt{M}}\sum_{m=1}^{M}cos\left \{ 2\pi f_{D}\,cos\left [ \frac{(2m-1)\pi + \theta}{4M} \right ].nT_{s}+\alpha_{m} \right \}\\ h_{Q}(nT_{s})=\frac{1}{\sqrt{M}}\sum_{m=1}^{M}sin\left \{ 2\pi f_{D}\,cos\left [ \frac{(2m-1)\pi + \theta}{4M} \right ].nT_{s}+\beta_{m} \right \} \\ h(nT_{s}) = h_{I}(nT_{s})+jh_{Q}(nT_{s}) \\\\ where \; \theta , \; \alpha_{m} \; and \; \beta_{m}\; are\; uniformly \;distributed\; over\; [0,2\pi)\\ for \;all\; n \;and\; are\; mutually\; distributed , \; \\ f_{D} = maximum\; Doppler\; spread, \; \\ T_{s}=sampling\; period, \; n=sample \; index \end{matrix} &s=2&fg=0000A0$

### Simulation:

1) The rayleigh fading model is implemented as a function in matlab with following parameters:
M=number of multipaths in the fading channel, N = number of samples to generate, fd=maximum Doppler spread in Hz, Ts = sampling period.

Check this book for full Matlab code.
Simulation of Digital Communication Systems Using Matlab – by Mathuranathan Viswanathan

2)The above mentioned function is used to generate Rayleigh Fading samples with the following values for the function arguments. M=15; N=10^5; fd=100 Hz;Ts=0.0001 second;

### Investigation of Statistical Properties of samples generated using Clarke’s model:

3) Mean and Variance of the real and imaginary parts of generated samples are
Mean of real part ~=0
Mean of imag part ~=0
Variance of real part = 0.4989 ~=0.5
Variance of imag part = 0.4989 ~=0.5

The results implies that the mean of the real and imaginary parts are same and are equal to zero.The variance of the real and imaginary parts are approximately equal to 0.5.

4)Next, the pdf of the real part of the simulated samples are plotted and compared against the pdf of Gaussian distribution (with mean=0 and variance =0.5)

5)The pdf of the generated Rayleigh fading samples are plotted and compared against pdf of Rayleigh distribution (with variance=1)

6) From 4) and 5) we confirm that the samples generated by Clarke’s model follows Rayleigh distribution (with variance = 1) and the real and imaginary part of the samples follow Gaussian distribution (with mean=0 and variance =0.5).

7) The Magnitude and Phase response of the generated Rayleigh Fading samples are plotted here.

### External Resources

• farid

Hi,

I work alone on my project of final year (enginner in telecommunications)
I have not found results about code of comparaison BICM and BICM-ID in the cannal AWGN and Rayleigh systems with matlab.

can you help me with small code matlab

• dongmo

please Sir Mathuranathan can you help me with small code matlab to generate the impulse response of rice channel?

• sorry. I do not have code right now. I will add it in the queue for the future posts

• Dzoni

Hi, great article!
Would you please be so kind to help me about my student project? I believe it’s a couple minutes for you.

Can you generate mathlab code for OFDM Double Rayleigh fading? It would help me a lot. Thank you.
Best regards.

• Ozan

Hi,
I have a question regarding above simulation code (also specified in your book), what is the delay spread in your above code? How can we add the delay spread into code?

• Ozan

I have bought your book and first of all I want to thank you for this useful working.I’m working on my thesis related to OFDM System on HF Channel. I learned useful informations from your book but I’d like to expect to see the sample Matlab code for OFDM system on Rayleigh channel. There is an example code in your book for AWGN channel, but I need Rayleigh channel with OFDM system. I want to use “rayleighchan” function in Matlab. Could you please help me regarding this topic? Do yu have any sample code for this issue?

• I do not have the ready-made available for this scenario. But the ebook contains all the resources required for it.

The simplest thing is to model the Rayleigh multipath as statistical random variable. The chapter 6.3 in the ebook contains the simulation code for BPSK over Rayleigh Channel. Here, the Rayleigh channel is modeled statistically. The same can be integrated in the OFDM model given in Chapter 7.

Thanks a lot for your support.

• Ozan

Thank you for your support. I have a little question. Can I model the path delays, Doppler shifts of the each paths using statistical random variable model as specified in your book? I’d like to simulate 2,3 or 4 paths and change the path delays (1 ms, 5 ms, 10 ms etc.), Doppler shifts (1 Hz, 10 Hz, etc). Do I have to use the “rayleighchan” function for it? Thank you in advance.

Hi,
When we generate time correlated channels using models like Jakes, Clarkes etc we also take the maximum doppler as a parameter.
When we consider finally modeling a channel as a FIR filter, before applying this filter to the data, depending on the doppler shift, is it required to multiply the time domain data with an exponential term or does the channel model take care of the frequency shift ?
basically we have x*exp(j2pi*delf*n/N) convolved with h = y
is jakes model finding a h’ such that x convolved with h’ mimics y ?