Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
3 views

Lab Simulation

The document describes simulations of wireless channel modeling and channel estimation using MATLAB, focusing on Rayleigh and Rician multipath fading channels and Doppler effects. It outlines the necessary components, theoretical background, procedures, and MATLAB programs used to simulate these phenomena. The results indicate successful modeling and estimation of wireless channels, with visualizations of the outputs included.

Uploaded by

ARI
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Lab Simulation

The document describes simulations of wireless channel modeling and channel estimation using MATLAB, focusing on Rayleigh and Rician multipath fading channels and Doppler effects. It outlines the necessary components, theoretical background, procedures, and MATLAB programs used to simulate these phenomena. The results indicate successful modeling and estimation of wireless channels, with visualizations of the outputs included.

Uploaded by

ARI
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

SIMULATION

EXPERIMENTS
Block Diagram:

Simulation Outputs:
EX.NO : 1 WIRELESS CHANNEL MODELLING SIMULATION INCLUDING FADING AND
DOPPLER EFFECTS

AIM:
To simulate the wireless channel Modelling including Rayleigh and Rician multipath fading channel system
objects and Doppler shifts.

COMPONENTS REQUIRED:
Personal computer
MATLAB software

THEORY:
Fading:
Fading is used to describe the rapid fluctuations of the amplitudes, phases or multipath delays of a radio
signal over a short period of time or travel distance, so that large-scale path loss effects may be ignored.
Fading is caused by interference between two or more versions of the transmitted signal which arrive at the
receiver at slightly different times. These waves called multipath waves, combine at the receiver antenna to
give a resultant signal which can vary widely in amplitude and phase, depending on the distribution of the
intensity and relative propagation time of the waves and the bandwidth of the transmitted signal.
The three most important effects are
Rapid changes in signal strength over a small travel distance or time interval.

Random frequency modulation due to varying Doppler shifts on different multipath signals.
Time dispersion (echoes) caused by multipath propagation delays.

Doppler Effects:
Due to the relative motion between the mobile and base station each multipath wave experiences an apparent
shift in frequency. The shift in received signal frequency due to motion is called Doppler Effect, and it is
directly proportional to the velocity and direction of motion of the mobile with respect to the direction of
arrival of the received multipath wave.

PROCEDURE:
Processing a signal using a fading channel involves the following steps:
1. Create a channel System object that describes the channel that you want to use. A channel object is a type
of MATLAB variable that contains information about the channel, such as the maximum Doppler shift.
2. Adjust properties of the System object, if necessary, to tailor it to your needs. For example, you can
change the path delays or average path gains.
3. Apply the channel System object to your signal using the step method, which generates random discrete
path gains and filters the input signal. The characteristics of a channel can be shown with the built-in
visualization support of the System object.
PROGRAM:
sampleRate500kHz = 500e3; % Sample rate of 500K Hz
sampleRate20kHz = 20e3; % Sample rate of 20K Hz
maxDopplerShift = 200; % Maximum Doppler shift of diffuse components (Hz)
delayVector = (0:5:15)*1e-6; % Discrete delays of four-path channel (s)
gainVector = [0 -3 -6 -9]; % Average path gains (dB)
KFactor = 10; % Linear ratio of specular power to diffuse power
specDopplerShift = 100; % Doppler shift of specular component (Hz)
% Configure a Rayleigh channel object
rayChan = comm.RayleighChannel( ...
'SampleRate', sampleRate500kHz, ...
'PathDelays', delayVector, ...
'AveragePathGains', gainVector, ...
'MaximumDopplerShift', maxDopplerShift, ...
'RandomStream', 'mt19937ar with seed', ...
'Seed', 10, ...
'PathGainsOutputPort', true);
% Configure a Rician channel object
ricChan = comm.RicianChannel( ...
'SampleRate', sampleRate500kHz, ...
'PathDelays', delayVector, ...
'AveragePathGains', gainVector, ...
'KFactor', KFactor, ...
'DirectPathDopplerShift', specDopplerShift, ...
'MaximumDopplerShift', maxDopplerShift, ...
'RandomStream', 'mt19937ar with seed', ...
'Seed', 100, ...
'PathGainsOutputPort', true);
qpskMod = comm.QPSKModulator( ...
'BitInput', true, ...
'PhaseOffset', pi/4);
% Number of bits transmitted per frame is set to be 1000. For QPSK
% modulation, this corresponds to 500 symbols per frame.
bitsPerFrame = 1000;
msg = randi([0 1],bitsPerFrame,1);
% Modulate data for transmission over channel
modSignal = qpskMod(msg);
% Apply Rayleigh or Rician channel object on the modulated data
rayChan(modSignal);
ricChan(modSignal);
release(rayChan);
release(ricChan);
rayChan.Visualization = 'Impulse and frequency responses';
rayChan.SamplesToDisplay = '100%';
numFrames = 2;
for i = 1:numFrames % Display impulse and frequency responses for 2 frames
% Create random data
msg = randi([0 1],bitsPerFrame,1);
% Modulate data
modSignal = qpskMod(msg);
% Filter data through channel and show channel responses
rayChan(modSignal);
end
release(rayChan);
rayChan.Visualization = 'Doppler spectrum';
numFrames = 5000;
for i = 1:numFrames % Display Doppler spectrum from 5000 frame transmission
msg = randi([0 1],bitsPerFrame,1);
modSignal = qpskMod(msg);
rayChan(modSignal);
end
Narrowband or Frequency-Flat Fading
release(rayChan);
rayChan.Visualization = 'Impulse and frequency responses';
rayChan.SampleRate = sampleRate20kHz;
rayChan.SamplesToDisplay = '25%'; % Display one of every four samples
numFrames = 2;
for i = 1:numFrames % Display impulse and frequency responses for 2 frames
msg = randi([0 1],bitsPerFrame,1);
modSignal = qpskMod(msg);
rayChan(modSignal);
end
release(rayChan);
rayChan.PathDelays = 0; % Single fading path with zero delay
rayChan.AveragePathGains = 0; % Average path gain of 1 (0 dB)
for i = 1:numFrames % Display impulse and frequency responses for 2 frames
msg = randi([0 1],bitsPerFrame,1);
modSignal = qpskMod(msg);
rayChan(modSignal);
end
release(rayChan);
rayChan.Visualization = 'Off'; % Turn off System object's visualization
ricChan.Visualization = 'Off'; % Turn off System object's visualization
% Same sample rate and delay profile for the Rayleigh and Rician objects
ricChan.SampleRate = rayChan.SampleRate;
ricChan.PathDelays = rayChan.PathDelays;
ricChan.AveragePathGains = rayChan.AveragePathGains;
% Configure a Time Scope System object to show path gain magnitude
gainScope = dsp.TimeScope( ...
'SampleRate', rayChan.SampleRate, ...
'TimeSpan', bitsPerFrame/2/rayChan.SampleRate, ... % One frame span
'Name', 'Multipath Gain', ...
'ShowGrid', true, ...
'YLimits', [-40 10], ...
'YLabel', 'Gain (dB)');
% Compare the path gain outputs from both objects for one frame
msg = randi([0 1],bitsPerFrame,1);
modSignal = qpskMod(msg);
[~, rayPathGain] = rayChan(modSignal);
[~, ricPathGain] = ricChan(modSignal);
% Form the path gains as a two-channel input to the time scope
gainScope(10*log10(abs([rayPathGain, ricPathGain]).^2));

RESULT:
Thus the wireless channel Modelling including Rayleigh and Rician multipath fading channel system objects
and Doppler shifts were simulated and the graphs are noted.
Block Diagram:
EX.NO: 2 SIMULATION OF CHANNEL ESTIMATION

AIM:
To Simulate the Channel Estimation techniques using MATLAB.

COMPONENTS REQUIRED:
Personal computer
MATLAB

THEORY:

Channel Estimation:
In digital wireless communication systems, information is transmitted through a radio channel. For
conventional, coherent receivers, the effect of the channel on the transmitted signal must be estimated to
recover the transmitted information. For example, with binary phase shift keying (BPSK), binary
information is represented as +1 and −1 symbol values. The radio channel can apply a phase shift to the
transmitted symbols, possibly inverting the symbol values. As long as the receiver can estimate what the
channel did to the transmitted signal, it can accurately recover the information sent.
Channel estimation is a challenging problem in wireless communications. Transmitted signals are typically
reflected and scattered, arriving at the receiver along multiple paths. When these paths have similar delays,
they add either constructively or destructively, giving rise to fading. When these paths have very different
delays, they appear as signal echoes. Due to the mobility of the transmitter, the receiver, or the scattering
objects, the channel changes over time.
Program:
enb.NDLRB = 15; % Number of resource blocks
enb.CellRefP = 1; % One transmit antenna port
enb.NCellID = 10; % Cell ID
enb.CyclicPrefix = 'Normal'; % Normal cyclic prefix
enb.DuplexMode = 'FDD'; % FDD
SNRdB = 22; % Desired SNR in dB
SNR = 10^(SNRdB/20); % Linear SNR
rng('default'); % Configure random number generators
cfg.Seed = 1; % Channel seed
cfg.NRxAnts = 1; % 1 receive antenna
cfg.DelayProfile = 'EVA'; % EVA delay spread
cfg.DopplerFreq = 120; % 120Hz Doppler frequency
cfg.MIMOCorrelation = 'Low'; % Low (no) MIMO correlation
cfg.InitTime = 0; % Initialize at time zero
cfg.NTerms = 16; % Oscillators used in fading model
cfg.ModelType = 'GMEDS'; % Rayleigh fading model type
cfg.InitPhase = 'Random'; % Random initial phases
cfg.NormalizePathGains = 'On'; % Normalize delay profile power
cfg.NormalizeTxAnts = 'On'; % Normalize for transmit antennas
cec.PilotAverage = 'UserDefined'; % Pilot averaging method
cec.FreqWindow = 9; % Frequency averaging window in REs
cec.TimeWindow = 9; % Time averaging window in REs
gridsize = lteDLResourceGridSize(enb);
K = gridsize(1); % Number of subcarriers
L = gridsize(2); % Number of OFDM symbols in one subframe
P = gridsize(3); % Number of transmit antenna ports
txGrid = [];
% Number of bits needed is size of resource grid (K*L*P) * number of bits
% per symbol (2 for QPSK)
numberOfBits = K*L*P*2;
% Create random bit stream
inputBits = randi([0 1], numberOfBits, 1);
% Modulate input bits
inputSym = lteSymbolModulate(inputBits,'QPSK');
% For all subframes within the frame
for sf = 0:10
% Set subframe number
enb.NSubframe = mod(sf,10);
% Generate empty subframe
subframe = lteDLResourceGrid(enb);
% Map input symbols to grid
subframe(:) = inputSym;
% Generate synchronizing signals
pssSym = ltePSS(enb);
sssSym = lteSSS(enb);
pssInd = ltePSSIndices(enb);
sssInd = lteSSSIndices(enb);
% Map synchronizing signals to the grid
subframe(pssInd) = pssSym;
subframe(sssInd) = sssSym;
% Generate cell specific reference signal symbols and indices
cellRsSym = lteCellRS(enb);
cellRsInd = lteCellRSIndices(enb);
% Map cell specific reference signal to grid
subframe(cellRsInd) = cellRsSym;
% Append subframe to grid to be transmitted
txGrid = [txGrid subframe]; %#ok
end
[txWaveform,info] = lteOFDMModulate(enb,txGrid);
txGrid = txGrid(:,1:140);
cfg.SamplingRate = info.SamplingRate;
% Pass data through the fading channel model
rxWaveform = lteFadingChannel(cfg,txWaveform);
% Calculate noise gain
N0 = 1/(sqrt(2.0*enb.CellRefP*double(info.Nfft))*SNR);
% Create additive white Gaussian noise
noise = N0*complex(randn(size(rxWaveform)),randn(size(rxWaveform)));

% Add noise to the received time domain waveform


rxWaveform = rxWaveform + noise;
offset = lteDLFrameOffset(enb,rxWaveform);
rxWaveform = rxWaveform(1+offset:end,:);
rxGrid = lteOFDMDemodulate(enb,rxWaveform);
enb.NSubframe = 0;
[estChannel, noiseEst] = lteDLChannelEstimate(enb,cec,rxGrid);
eqGrid = lteEqualizeMMSE(rxGrid, estChannel, noiseEst);
% Calculate error between transmitted and equalized grid
eqError = txGrid - eqGrid;
rxError = txGrid - rxGrid;
% Compute EVM across all input values
% EVM of pre-equalized receive signal
EVM = comm.EVM;
EVM.AveragingDimensions = [1 2];
preEqualisedEVM = EVM(txGrid,rxGrid);
fprintf('Percentage RMS EVM of Pre-Equalized signal: %0.3f%%\n', ...
preEqualisedEVM);
% EVM of post-equalized receive signal
postEqualisedEVM = EVM(txGrid,eqGrid);
fprintf('Percentage RMS EVM of Post-Equalized signal: %0.3f%%\n', ...
postEqualisedEVM);
% Plot the received and equalized resource grids
hDownlinkEstimationEqualizationResults(rxGrid, eqGrid);

Result:
Thus the Simulation of Channel Estimation techniques was done using MATLAB and the output was
verified.

You might also like