# Matlab: Correct method of generating Rayleigh fading channel

A Rayleigh flat fading channel has 1 tap and so there will be no intersymbol interference. if

N= 1000;
Then,
h=(1/sqrt(2))*(randn(N,1)+1i*randn(N,1));


will generate 1000 coefficients which are complex Gaussian of zero mean.

Question 1: Is this a multi-path Rayleigh channel of number of taps = 1000?(Example taken from : http://www.mathworks.com/matlabcentral/fileexchange/30477-ber-curve-for-bpsk-in-rayleigh-channel/content/BER_BPSK_Rayleigh.m )

But, there are models such as Clarke's method of sinusoid and Jake's algorithm for modeling the Rayleigh channel as FIR. If the method in Question 1 and these algorithm create multi-path Rayleigh, then when do we use the Algorithm?

Question 2: In the code and explanation therein for Rayleigh flat fading code , a channel of length N is created but it is called flat. I am really confused as to what is the proper way to create multi-path Rayleigh fading and only flat Rayleigh fading (1 tap).

• Just in case you need a more convenient way to generate fading channel in matlab, you can use fading channel object. For Rayleigh fading it is the rayleighchan() function. The object can manage Doppler, tap distribution, ... The document about this object is here which is well written fr.mathworks.com/help/comm/ug/fading-channels.html – AlexTP Apr 26 '17 at 9:51

Question 1:

Yes, it is a multipath Rayleigh Channel with $1000$ taps. You need to know that when you generate complex coefficients, and the real part and the imaginary part of this coefficients are randomly chosen according to a Gaussian distribution, the magnitude will have a Rayleigh distribution and the phase will have a uniform distribution between $0$ and $2 \pi$. The problem with this method, is that you don't have control on how the channel varies: the channel in a given instant of time will have no correlation with the channel in the previous instant. To add this correlation, we use the others methods as Clark's and Jake's models.

Question 2:

Look what he wrote in his website, in the assumptions section:

1. The channel is flat fading – In simple terms, it means that the multipath channel has only one tap. So, the convolution operation reduces to a simple multiplication.

In his code, he is performing a multiplication, not a convolution, when applying the Rayleigh Channel.

He generates $N$ coefficients, but what he is trying to do is simulate the channel variation in time, so each symbols is multiplied by an attenuation (inside the vector h). The vector h is not a vector of a filter coefficients, but a vector that stores the channel attenuation for each symbol.

• Thank you for your reply. In the first Question the way coefficients are generated is the same as that for flat fading ie, h=(1/sqrt(2))*(randn(N,1)+1i*randn(N,1)); so 1000 coefficients = 1000 taps. But in flat fading there should be only 1 tap and looking at his code, he generates N coefficients. As you have mentioned that he has multiplied the data with the N coefficients. – Ria George Nov 12 '15 at 16:16
• So, if I would want to generate flat fading and multipath then what is the proper way for applying it to the signal in order to differentiate between flat and multipath because the way the taps are generated for flat and multi path is the same. This has confused me. – Ria George Nov 12 '15 at 16:16
• In multipath fading, you need to convolve your signal with the channel coefficients, using the filter function. In flat fading, you just multiply your signal for the channel tap. – JohnMarvin Nov 12 '15 at 19:39

I think 'N=1000' means there are 1000 transmitters. Only 1 tap is for each transmitter, and hence the received signal is y=h.*x (multiplication not convolution due to 1 tap of h for each element in vector x)in his code.