# How can I generate time-variant Rayleigh channel in MATLAB

One of known models for channel simulation is called Rayleigh Fading channel, it's usually used to simulate wireless channel in time variant/invariant.

As I know, Rayleigh fading channel can be considered as sum of two Gaussian random variables, we can use the below command to generate that channel:

h = 1/sqrt(2)*[randn(1,M+1) + 1i*randn(1,M+1)];


Where M is channel length and h will be the channel.

But what's about if I want to generate Rayleigh channel in time-variant environment? is that possible? Please correct me if the above command generates Rayleigh channel or there is another command.

thank you

• I will only comment as this is from the top of my head rather than best established practices which I know exist. To simulate a Rayleigh channel use the central limit theorem to generate multiple randomly selected paths and sum them--- this is what an FIR filter does. So use a complex FIR filter with a tap spacing consistent with your sampling rate with enough samples to exceed your simulated delay spread and assign coefficients (I and Q as it is a complex filter) from a random distribution. – Dan Boschen Nov 5 '18 at 13:13
• Given enough taps the resulting waveform will have a Gaussian distributed amplitude in both I and Q (from the central limit theorem), and a uniformly distributed phase-which is the result of a Rayleigh channel (as the MAGNITUDE of the complex samples will be Rayleigh distributed for such a waveform). To make time varying, update the taps consistent with the time variation desired. – Dan Boschen Nov 5 '18 at 13:13
• This may also help: dsp.stackexchange.com/questions/51902/… – Dan Boschen Nov 5 '18 at 13:14
• If you have the communications toolbox, then you can use comm.RayleighChannel(). – Tendero Nov 5 '18 at 13:26
• @Tendero I tried to use that, I have communications toolbox, but how can I set the length of channel? for example I need the channel length to be 64, how can I set that? could you please provide me with details ? – New_student Nov 5 '18 at 14:26

Yes, you can have time variant channel in MATLAB either by using comm.RayleighChannel() , you can read about it in help of matlab.

or the other way you use the same command you have mentioned but with each symbol the channel should be changed. so it will be like you will generate a channel which is Quasi-static. You above command will become:

h = 1/sqrt(2)*[randn(n_symbol,M+1) + 1i*randn(n_symbol,M+1)];


where n_symbol represents the number of symbols you have. then to do the convolution, must be use the loop of for.

for jj = 1:nSym

  new_signal(jj,:) = conv(h(jj,:),x(jj,:));   %% x is your signal


end

good luck