Rayleigh Channel model matlab code | Rayleigh MATLAB

This page mentions Rayleigh Channel model matlab code. It describes Rayleigh MATLAB simulation parameters with code script. Rayleigh Channel model PLOTS are also shown.

There are many channel models used for simulation in wireless signal transmission technologies. The most basic channel model used by designers is Rayleigh model. In this model, only Non Line of Sight(NLOS) components are simulated between transmitter and receiver. MATLAB provides built in function by name 'rayleighchan' as explained below along with rayleigh matlab code. This channel model is used to implement real time fading observed in wireless communication system. Refer complete article on fading basics and fading types >>.

The MATLAB function is as below:
chl_res=rayleighchan(Ts,Fd,Tau,PdB);
Where, Ts=sampling time of the input signal in unit of seconds
Fd= Maximum doppler shift in unit of Hz.
Tau= raw vector consisting path delays in unit of seconds
PdB= raw vector cosisting path gains in unit of dB
chl_res= channel coefficients returned by matlab function rayleighchan

Rayleigh MATLAB Code

Following is the script written in MATLAB for Rayleigh channel model.

%3-path Rayleigh Matlab code
clc;
clear all;
close all;
load file_ldacstxpkt; % baseband IQ vector
Tx_Packet=Tx_Packet.';
Ts=1e-4; % sampling time in second
Fd=100; % doppler frequency in Hz
Tau=[0 1.5e-4 2.5e-4]; % delay for the three paths
PdB=[0, -2, -6]; % power in each of the three paths
pkt_allones=ones(1,480)+i*ones(1,480);
% Rayleigh channel model
h = rayleighchan(Ts, Fd, Tau, PdB);
h.StoreHistory = true;
Rx_pkt_allones = filter(h, pkt_allones);
Rx_Packet = filter(h, Tx_Packet); % passing baseband IQ vector through rayleigh channel
figure;plot(h);
figure;plot(abs(Tx_Packet)); title('baseband IQ packet without rayleigh channel');
figure;plot(abs(Rx_Packet)); title('baseband IQ packet with rayleigh channel');
figure;plot(abs(Rx_pkt_allones)); title('baseband IQ of all ones after passing through rayleigh channel');

Rayleigh Channel model PLOTS

Following are the plots which depicts rayleigh channel impulse response, baseband IQ vector without channel, baseband IQ vector with channel and channel response with baseband IQ vector consiting of all ones in the packet.

rayleigh channel impulse response Baseband IQ vector without channel
Baseband IQ vector with rayleigh channel channel response with all ones baseband vector with rayleigh

Rayleigh Matlab plots

Download Rayleigh MATLAB source code

Download Rayleigh channel model matlab source code files.

Useful Links to MATLAB codes

Refer following as well as links mentioned on left side panel for useful MATLAB codes.
OFDM Preamble generation  Time off estimation corr  Freq off estimation corr  channel estimation  11a WLAN channel  PN sequence generation  OFDMA Tx Rx  AES DES  carrier aggregation  CCDF  FIR Filter  IIR Filter  Low Pass FIR  Viterbi decoder  CRC8 CRC32 

RF and Wireless tutorials

WLAN  802.11ac  802.11ad  wimax  Zigbee  z-wave  GSM  LTE  UMTS  Bluetooth  UWB  IoT  satellite  Antenna  RADAR