Experiment: 6 Object

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

0112EC071102 EC-2 (BIST)

EXPERIMENT : 6
OBJECT:
Simulation of transmission through a Rayleigh fading channel.

INTRODUCTION:
Rayleigh and Rician fading channels are useful models of real-world phenomena in wireless
communication. These phenomena include multipath scattering effects, time dispersion, and
Doppler shifts that arise from relative motion between the transmitter and receiver.
This demo shows how to use the following in order to model a fading channel:
1. Rayleigh and Rician multipath fading channel objects
2. Channel visualization tool

LAB WORK:

Initialization
The following variables control both the Rayleigh and Rician channel objects. By default, the
channel is modeled as four fading paths, each representing a cluster of multipath components
received at around the same delay.
sampleTime = 1/500000; % Sample time (s)
maxDopplerShift = 200; % Maximum Doppler shift of diffuse components (Hz)
delayVector = 1.0e-004 * [0 0.0400 0.0800 0.1200]; % Discrete delays of
% four-path channel (s)
gainVector = [0 -3 -6 -9]; % Average path gains (dB)
specDopplerShift = 100; % Doppler shift of specular component (Hz)
KFactor = 10; % Linear ratio of specular power to diffuse power

Creating Channel Objects


With the parameters specified above, we can now create the Rayleigh and Rician channel objects
using the RAYLEIGHCHAN and RICIANCHAN functions.
% Create Rayleigh channel object
rayChanObj = rayleighchan(sampleTime, maxDopplerShift, delayVector,...
gainVector) ;
rayChanObj.StoreHistory = 1; % Store channel state information as signal is
% processed for later visualization
% Create Rician channel object
ricChanObj = ricianchan(sampleTime, maxDopplerShift, KFactor, ...
delayVector, gainVector, specDopplerShift);
ricChanObj.StoreHistory = 1; % Store channel state information as signal is
% processed for later visualization
Modulation and Channel Filtering
The MODEM.PSKMOD function can be used to create a PSK modulator object The modulation
object can then be used to modulate the channel data, which has been generated using the
RANDINT function here. Note that in the code below a 'frame' refers to a vector of information
bits.
% QPSK modulation with a phase offset of pi/4 is used for this demo
phaseOff = pi/4;
BANSAL INSTITUTE OF SCIENCE AND TECHNOLOGY,BHOPAL
0112EC071102 EC-2 (BIST)

modObj = modem.pskmod(4, phaseOff);


modObj.InputType = 'Bit';

% Number of bits transmitted per frame is set to be 1000. For QPSK


% modulation, this corresponds to 500 symbols per frame.
bitsPerFrame = 1000;
msg = randint(bitsPerFrame,1);

% Modulate data for transmission over channel


modSignal = modulate(modObj, msg);

% Apply channel object on the modulated data using the FILTER function
filter(rayChanObj,modSignal);
filter(ricChanObj, modSignal);

Visualization

channel_vis(rayChanObj, 'Visualization', 'ir'); % View Impulse Response


channel_vis(rayChanObj, 'Animation', 'medium'); % Set animation speed
channel_vis(rayChanObj, 'SampleIndex', 1); % Set animation start point

% Note: In this plot, the gains do not equal the average path gains because
% the Doppler effect causes the gains to fluctuate around their average
% values over time

OUTPUT

BANSAL INSTITUTE OF SCIENCE AND TECHNOLOGY,BHOPAL


0112EC071102 EC-2 (BIST)

Narrowband or Frequency-Flat Fading


If the bandwidth is too small for the signal to resolve the individual components, the frequency
response is approximately flat because of the minimal time dispersion caused by the multipath
channel. This kind of low-dispersion multipath fading is often referred to as narrowband fading,
or frequency-flat fading.
channel_vis(rayChanObj, 'close'); % Close Channel Visualization Tool
sampleTime = 1/20000; % 20 kb/s transmission

% Set data characteristics


bitsPerFrame = 1000;
numFrames = 20;

% Create a Rayleigh channel object


rayChanObj = rayleighchan(sampleTime, maxDopplerShift, delayVector,...
gainVector) ;
rayChanObj.StoreHistory = 1;
rayChanObj.ResetBeforeFiltering = 0; % Retain channel states across
% multiple frames

% Process multiple frames


for i = 1:numFrames
msg = randint(bitsPerFrame,1); % Create data
modSignal = modulate(modObj, msg); % Modulate data
filter(rayChanObj,modSignal); % Apply channel filtering to the data
channel_vis(rayChanObj, 'Visualization', 'fr'); % Frequency response
plot(rayChanObj);
end

% Visualize the channel frequency response


channel_vis(rayChanObj, 'Animation', 'medium');
channel_vis(rayChanObj, 'SampleIndex', 1);
Note that all delayed components combine at a single delay (in this case, at zero). Using the
"Multipath gain" visualization, you can validate this narrowband fading behavior. When the
signal's fading envelope (blue dashed curve) closely approximates the "Narrowband" curve
(magenta dots), you can regard the channel as exhibiting narrowband fading.
channel_vis(rayChanObj, 'Visualization', 'gain');
To simplify and speed up modeling, narrowband fading channels are typically modeled as a
single-path fading channel. (That is, a multiple-path fading model overspecifies a narrowband
fading channel.) The following settings correspond to a narrowband fading channel. Notice that
the shape of the bandlimited impulse response is also flat.
delayVector = 0; % Single fading path with zero delay
gainVector = 0; % Average path gain of 1 (0 dB)
channel_vis(rayChanObj, 'close');

% Set data characteristics


BANSAL INSTITUTE OF SCIENCE AND TECHNOLOGY,BHOPAL
0112EC071102 EC-2 (BIST)

bitsPerFrame = 1000;
numFrames = 100;

% Create a Rayleigh channel object


rayChanObj = rayleighchan(sampleTime, maxDopplerShift, delayVector,...
gainVector) ;
rayChanObj.StoreHistory = 1;
rayChanObj.ResetBeforeFiltering = 0;

% Process multiple frames


for i = 1:numFrames
msg = randint(bitsPerFrame,1); % Create data
modSignal = modulate(modObj, msg); % Modulate data
filter(rayChanObj,modSignal); % Apply channel filtering to data
channel_vis(rayChanObj, 'Visualization', 'fr'); % Frequency response
plot(rayChanObj);
end

% View channel frequency response


channel_vis(rayChanObj, 'Visualization', 'fr');
channel_vis(rayChanObj, 'Animation', 'medium');
channel_vis(rayChanObj, 'SampleIndex', 1);
The single-path fading channel is modeled as a complex gain, which captures both the
attenuation and phase shift of the channel. The "Phasor trajectory" visualization shows how this
complex gain changes over a transmitted frame. The blue line is the phasor of the path, and the
green line is its trajectory over time. The signal experiences a deep fade when this trajectory
passes through or near zero.
channel_vis(rayChanObj, 'Visualization', 'phasor');
channel_vis(rayChanObj, 'Animation', 'slow');
channel_vis(rayChanObj, 'SampleIndex', 1);
The "Multipath gain" visualization shows the dB gain of the fading channel. The magnitude
fluctuates over a 30-40 dB range in the Rayleigh fading channel.
channel_vis(rayChanObj, 'Visualization', 'gain');
The Doppler spectrum is a statistical characterization of the fading process. The channel
visualization tool makes periodic measurements of the Doppler spectrum (blue dots). Over time,
the average of this measurement better approximates the theoretical Doppler spectrum (red
dashed curve). A close approximation indicates good statistical coverage by the Rayleigh fading
process.
channel_vis(rayChanObj, 'close');

% View Doppler spectrum


channel_vis(rayChanObj, 'Visualization', 'doppler');

BANSAL INSTITUTE OF SCIENCE AND TECHNOLOGY,BHOPAL


0112EC071102 EC-2 (BIST)

OUTPUT

BANSAL INSTITUTE OF SCIENCE AND TECHNOLOGY,BHOPAL

You might also like