Simulating Channel Model Impairments with Rayleigh Fading in MATLAB
Advertisement
This document explains how to simulate channel model impairments and the Rayleigh channel effect on a constellation diagram using MATLAB code.
MATLAB Source Code
The MATLAB code is divided into parts. Parts A and C are assumed to be the same as in the AWGN (Additive White Gaussian Noise) example. This section focuses on Part B, which adds the Rayleigh channel.
Part B: Adding Rayleigh Channel
% Adding Rayleigh channel
choice=input('Enter 1 to apply the channel, other no. to bypass:');
% 10 Hz;sample time=0.1e-3;
if(choice==1)
ts=(256/4e6);
doppler=0.1;
tau=[0.0 0.4 0.9];
pdb=[0 -15 -20];
chan = rayleighchan(ts,doppler,tau,pdb);
% TS is the sample time of the input signal, in seconds.
% FD is the maximum Doppler shift, in Hertz.
% 100 Hz
map_out_chl=filter(chan,mapper_out_ori);
figure;plot(real(map_out_chl),imag(map_out_chl),'r+');title('constellation with channel');
else
disp('no channel applied proceed to DC offset');
end
Explanation:
- The code first prompts the user to choose whether to apply the Rayleigh channel or not.
- If the user enters
1
, the Rayleigh channel is applied. - The
rayleighchan
function creates a Rayleigh fading channel object. The parameters are:ts
: Sample time of the input signal (calculated as256/4e6
in this example).doppler
: Maximum Doppler shift (set to0.1 Hz
here).tau
: Delay vector (set to[0.0 0.4 0.9]
in this example). These represent the delays of different paths in the channel.pdb
: Power delay profile (set to[0 -15 -20]
in this example). These represent the average power of the paths specified intau
, in dB.
- The
filter
function applies the Rayleigh fading to the output of the mapper (mapper_out_ori
). - Finally, the constellation diagram of the signal after passing through the channel (
map_out_chl
) is plotted. - If the user enters anything other than
1
, the channel is bypassed and the script proceeds (presumably to a DC offset adjustment, based on thedisp
message).
Input and Output Constellation Diagrams
Here are example constellation diagrams, before and after the channel effect.