Advanced Communication Lab
Advanced Communication Lab
Communication
Networks
Lab Manual
By
M V K Gayatri Shivani
Assistant Professor
List of Experiments
Software Experiments
1. BER performance of AWGN wireless system using MAT LAB software.
1a. BER Performance of a 16 QAM wireless system with AWGN
1b. Comparison of BER Performance
2. Simulation of OFDM system using MATLAB software.
3. Simulate and test various types of PN codes, chip rate, spreading factor
and processing gain on performance of DSSS in CDMA using MAT LAB
software.
Reference Textbooks:
1. Wireless Communication Systems in MATLAB – Mathuranathan
Vishwanathan (2nd Edition)
Software Experiments
1. BER performance of AWGN wireless system using MAT LAB
software.
1a. BER performance of a16QAM wireless system with AWGN
Aim: To design and simulate a Wireless system in AWGN channel and
analyze its performance based on BER
Software used: MATLAB Communication Systems Toolbox
Theory:
AWGN Channel:
Additive white Gaussian noise (AWGN) is a basic noise model used in
information theory to mimic the effect of many random processes that occur
in nature. The modifiers denote specific characteristics:
Additive: because it is added to any noise that might be intrinsic to the
information system.
White: refers to the idea that it has uniform power spectral density across
the frequency band for the information system. It is an analogy to the color
white which may be realized by uniform emissions at all frequencies in the
visible spectrum.
Gaussian: because it has a normal distribution in the time domain with an
average time domain value of zero (Gaussian process).
BLOCK Diagram
PROCEDURE
1. Open Matlab on your PC
2. Open a new live script file(.mlx )
3. Write your code, save and run it
Algorithm:
1. Generate a bit sequence using rand function
2. Modulate the bit sequence
3. Add AWGN noise
4. Demodulate the signal
5. Compare the demodulated signal with the original signal to find the no of
errors
6. Calculate the BER-Practical and theoretical
7. Repeat the steps for different SNR levels
8. Plot the correlation between SNR and BER
Code:
% Simulation parameters
numBits = 20000
srcBits = randi([0,1],numBits,1);
scatterplot(modOut);
% ADD Noise
EbNo = 15
chanOut = awgn(modOut,EbNo)
demodOut= qamdemod(chanOut,modOrder,'OutputType','bit','UnitAveragePower',true);
isBitError = srcBits~=demodOut
numBitErrors = nnz(isBitError)
BER = numBitErrors/numBits
[numErrors,ber1] = biterr(srcBits,demodOut);
EbNo = 15
bertheo = berawgn(EbNo,'qam',modOrder)
Results:
The theoretical bit error rate is: _ _____________
The practical bit error rate is: _________________
RESULTS:
Conclusion:
1. BER is inversely proportional to SNR
2. For the same SNR level, a signal with higher level of modulation
performs poorly as compared to a signal modulated with lower level
of modulation
Simulation of OFDM system using MATLAB
2a. Generate OFDM modulated symbols for use in link-level
simulations.
Construct an OFDM modulator with an inserted DC null, seven
guard-band subcarriers, and two symbols having different pilot
indices for each symbol
Aim: To design a OFDM system with the given parameters
Software Used: MATLAB Communication Toolbox
Theory:
Orthogonal frequency division modulation (OFDM) divides a high-rate transmit data
stream into N lower-rate streams, each of which has a symbol duration larger than the
channel delay spread. This serves to mitigate intersymbol interference (ISI). The
individual substreams are sent over N parallel subchannels which are orthogonal to
each other. Through the use of an inverse fast Fourier transform (IFFT), OFDM can
be transmitted using a single radio. Specifically, the OFDM Modulator System object
modulates an input signal using orthogonal frequency division modulation. The
output is a baseband representation of the modulated signal:
mod = comm.OFDMModulator('NumGuardBandCarriers',[4;3],'PilotInputPort',true,
'PilotCarrierIndices',[12 11 8; 26 27 20; 40 39 30; 54 55 50],'NumSymbols',3,
'InsertDCNull',true);
disp(ofdmMod)
modDim = info(mod)
%%% Generate random data symbols for the OFDM modulator. The structure variable,
dataIn = complex(randn(modDim.DataInputSize),randn(modDim.DataInputSize));
pilotIn = complex(rand(modDim.PilotInputSize),rand(modDim.PilotInputSize));
modData = step(mod,dataIn,pilotIn);
% Y = step(OBJ,x) processes the input data, x, to produce the output, Y,for System
object, OBJ.
showResourceMapping(mod)
%% % Use the OFDM modulator object to create the corresponding OFDM demodulator.
demod = comm.OFDMDemodulator(mod);
%%% Demodulate the OFDM signal and output the data and pilot signals.
%% % Verify that, within a tight tolerance, the input data and pilot symbols match
the output data and pilot symbols.
RESULTS
For 3 symbols
srcBits = randi([0,1],numBits,1);
qamModOut =
qammod(srcBits,modOrder,"InputType","bit","UnitAveragePower",true);
scatterplot(qamModOut)
title("16-QAM Signal")
%Perfrom OFDM
ofdmModOut = ifft(qamModOut)
%Apply AWGN
SNR = 15; % dB
chanOut = awgn(ofdmModOut,SNR,"measured");
% Perform Demodulation
ofdmDemodOut = fft(chanOut)
scatterplot(ofdmDemodOut)
Aim: To perform a symbol error rate (SER) simulation of an over-the-air OFDM communication
link.
Code.
qpskMod = comm.QPSKModulator;
qpskDemod = comm.QPSKDemodulator;
ofdmMod = comm.OFDMModulator;
ofdmDemod = comm.OFDMDemodulator;
Use the info function to determine the required input dimensions for the OFDM modulator.
modDim = info(ofdmMod)
Set the number of frames. Determine the number of OFDM symbols per frame from the
modDim.DataInputSize array.
numBits = 100;
nSymbolsPerFrame = modDim.DataInputSize(1);
Create an error rate counter with a reset input port. Initialize the symbol error rate vector, SER.
errRate = comm.ErrorRate('ResetInputPort',true);
SER = zeros(nFrames,1);
for k = 1:nFrames
% Generate random data for each OFDM frame
txQPSK = qpskMod(data);
txSig = ofdmMod(txQPSK);
rxSig = awgn(txSig,23);
rxQPSK = ofdmDemod(rxSig);
rxData = qpskDemod(rxQPSK);
% Compute BER
errors = errRate(data,rxData,1);
SER(k) = errors(1);
end
Display the symbol error data for the first ten frames.
SER(1:10)
RESULTS: The symbol error rates for the first ten frames are as follows: _________-
3. Simulate and test various types of PN codes, chip rate, spreading
factor and processing gain on performance of DSSS in CDMA using
MAT LAB software
Aim: To design a DSSS system with the given parameters
Software Used: MATLAB Communication Toolbox
Theory: In telecommunications, direct-sequence spread spectrum (DSSS) is a spread-
spectrum modulation technique primarily used to reduce overall signal interference. The
direct-sequence modulation makes the transmitted signal wider in bandwidth than the
information bandwidth. After the despreading or removal of the direct-sequence
modulation in the receiver, the information bandwidth is restored, while the unintentional
and intentional interference is substantially reduced.
Direct-sequence spread-spectrum transmissions multiply the symbol sequence being
transmitted with a spreading sequence that has a higher rate than the original message
rate. Usually, sequences are chosen such that the resulting spectrum is spectrally white.
Knowledge of the same sequence is used to reconstruct the original data at the receiving
end. This is commonly implemented by the element-wise multiplication with the
spreading sequence, followed by summation over a message symbol period. This process,
despreading, is mathematically a correlation of the transmitted spreading sequence with
the spreading sequence. In an AWGN channel, the despreaded signal's signal-to-noise
ratio is increased by the spreading factor, which is the ratio of the spreading-sequence rate
to the data rate.
While a transmitted DSSS signal occupies a wider bandwidth than the direct modulation
of the original signal would require, its spectrum can be restricted by conventional pulse-
shape filtering.
If an undesired transmitter transmits on the same channel but with a different spreading
sequence, the despreading process reduces the power of that signal. This effect is the
basis for the code-division multiple access (CDMA) method of multi-user medium
access, which allows multiple transmitters to share the same channel within the limits of
the cross-correlation properties of their spreading sequences.
DSSS Transmitter
DSSS Receiver
PROCEDURE
1. Open Matlab on your PC
2. Open a new live script file(.mlx )
3. Write your code, save and run it
%System Parameters
d=randi([0,1],10,1)
Rb=10 ;%datarate,
Rc=20;%chiprate and
L=32;%oversamplingfactor
%Spreading Sequence
pnSequence =
comm.PNSequence('Polynomial',[3,2,0],'SamplesPerFrame',dataLen,'InitialConditio
ns',[0 0 1]);
prbs = pnSequence()
prbs=prbs(:);
d=d(:);%serialize
d_t=kron(d,ones(L*Rc/Rb,1));%datawaveform
prbs_t=kron(prbs,ones(L,1));%spreadingsequencewaveform
sbb_t=2*xor(d_t,prbs_t)-1;%XORdataandPRBS,converttobipolar
n=(0:1:length(sbb_t)-1).';
carrier_ref=cos(2*pi*2*n/L);
s_t=sbb_t.*carrier_ref;%modulation,2cyclesperchip
%------------BPSK Demodulation---------
v_t=r_t.*carrier_ref;
%-----------De-Spreading---------------
figure(1);%Plotwaveforms
subplot(4,1,1);plot(d_t);title('datasequence');
hold on;
subplot(4,1,2);plot(prbs_t);title('PRBSsequence');
hold on
subplot(4,1,3);plot(s_t);title('DS-SSsignal(baseband)');
hold on
subplot(4,1,4);plot(d_cap);
N=10e3;%numberofdatabitstotransmit
d=randi([0,1],N,1)%randomdata
Rb=2e1;%datarate(bps)forthedatad
Rc=6e1;%chip-rate(Rc>>RbANDRcisintegralmultipleofRb)
L=8;%oversamplingfactorforwaveformgeneration
SNR_dB=-4:0.5:10; %signaltonoiseratios(dB)
BER=zeros(1,length(SNR_dB));%placeholderforBERvalues
%Spreading Sequence
pnSequence =
comm.PNSequence('Polynomial',[3,2,0],'SamplesPerFrame',dataLen,'InitialConditio
ns',[0 0 1]);
prbs = pnSequence()
prbs=prbs(:);
d=d(:);%serialize
for i=1:length(BER)
% Transmitter
%Spread Spectrum Communication
d_t=kron(d,ones(L*Rc/Rb,1));%datawaveform
prbs_t=kron(prbs,ones(L,1));%spreadingsequencewaveform
sbb_t=2*xor(d_t,prbs_t)-1;%XORdataandPRBS,converttobipolar
n=(0:1:length(sbb_t)-1).';
carrier_ref=cos(2*pi*2*n/L);
s_t=sbb_t.*carrier_ref;%modulation,2cyclesperchip
%-----Compute andaddAWGNnoisetothetransmittedsignal--
Esym=L*sum(abs(s_t).^2)/(length(s_t));%Calculatesymbolenergy
N0=Esym/(10^(SNR_dB(i)/10));%Findthenoisespectraldensity
n_t=sqrt(N0/2)*randn(length(s_t),1);%computednoise
r_t=s_t +n_t;%receivedsignal
%RECIEVER
%------------BPSK Demodulation---------
v_t=r_t.*carrier_ref;
%-----------De-Spreading---------------
BER(i)=(sum(dCap~=d')/length(d));%BitErrorRate
end
%PLOTS
theoreticalBER=0.5*erfc(sqrt(10.^(SNR_dB/10)));
figure;
semilogy(SNR_dB,BER,'k*');
hold on;
semilogy(SNR_dB,theoreticalBER,'r');
RESULT:
Hardware Experiments
DPSK -Modulation and Demodulation technique
Aim: Study DPSK Modulation and Demodulation Technique
Equipment Used:
1. Kit :-
2. DSO
3. Probes
Theory:
DPSK stands for Differential Phase Shift Keying. It is the version of BPSK.
In DPSK, there is no absolute carrier phase reference, instead transmitted
signal itself used as phase reference. There are various applications of DPSK
such as WLANs, Bluetooth and RFID communication. The most popular
among them is its use of Bluetooth where π/4 - DQPSK and 8-DPSK
modulation variants of DPSK has been employed.In DPSK demodulation,
phase of the received bit is compared with phase of the previous bit.
Procedure
Modulation and Demodulation
Results/Calculations:
Modulation:
1. Note Down the bit sequence and sketch the graph
Bit Sequence - ______________
2. Perform Differential encoding ( with initial bit 1 and initial bit
0) sketch the graph for the differential encoded sequence
displayed on the oscilloscope
I channel differentially encoded sequence ________
Q channel differentially encoded sequence___________
3. Sketch the output of differentially encoded data and output of
product modulator
4. Sketch the output of the summer
Conclusion:
1. In DPSK the data is encoded is phase change rather than the
absolute phase.
2. Observe the delay and error in demodulated signal and note
it down.
QPSK Modulation and Demodulation technique
Aim: Study QPSK Modulation and Demodulation Technique
Equipment Used:
Theory:
Procedure
Modulation and Demodulation
Observation:
Modulation
Demodulation
Results/Calculations:
Modulation:
5. Note Down the bit sequence and sketch the graph
Bit Sequence - ______________
6. Perform 2 bit encoding and sketch the graphs
I channel bit sequence _________
Q channel bit Sequence _______________
7. Sketch the output of I channel and Q channel data and output of
product modulator
8. Sketch the output of the summer
Example:
Modulation:
Demodulation:
Conclusion:
In QPSK the data is encoded in absolute phase of the signal.
Observe the delay and error in demodulated signal and note it
down
DQPSK Modulation and Demodulation technique
Aim: Study DQPSK Modulation and Demodulation Technique
Equipment Used:
Theory:
Procedure
Modulation and Demodulation
Observation:
Modulation
Demodulation
Results/Calculations:
Modulation:
9. Note Down the bit sequence and sketch the graph
Bit Sequence - ______________
10. Perform 2 bit encoding and sketch the graphs
I channel bit sequence _________
Q channel bit Sequence _______________
11. Perform Differential encoding ( with initial bit 1 and initial
bit 0) sketch the graph for the differential encoded sequence
displayed on the oscilloscope
I channel differentially encoded sequence ________
Q channel differentially encoded sequence___________
12. Sketch the output of differentially encoded data and output
of product modulator
13. Sketch the output of the summer
Example:
Modulation:
Demodulation:
Conclusion:
In DQPSK the data is encoded is phase change rather than the
absolute phase.
Observe the delay and error in demodulated signal and note it
down.
FSK Modulation and Demodulation
RESULTS :
MSK Modulation and Demodulation
MSK STEPS
o In Minimum-shift keying, bits are separated in even and odd bits and each
bit's duration is doubled.
o After that, frequency is separated into two types of frequencies f1 and f2.
Here, f1 determines/denotes the low frequency, and f2 denotes the high
frequency.
o Original or inverted signals are chosen from the frequency generating table
according to the bit values if they are even or odd.
o The curve for higher frequency takes a complete wave from 0 to π, and the
curve for low frequency takes a wave 0 to π/2 within the same interval of time.
Let's take an example to demonstrate the working of Minimum-shift keying and draw
a curve for a given bit stream. Let's consider a bit stream 1011010. Here, we have to
find the MSK curve for this bit stream.
Step 1: First, draw the curve according to the bit value of amplitude. If the bit is zero,
it would have amplitude while is the bit is zero, it does not have amplitude.
Step 2: Now, start with the odd bit. If the bit's value is one, draw the curve above the
x-axis twice as long as the original one. If the bit's value is zero, draw the curve below
the x-axis twice as long as the original size.
Step 3: Now, draw the curve for high and low frequency, as shown in the following
graph. It would remain the same for any problem.
Step 4: This is the final step. Now, draw the final curve according to the frequency
generating table. In the following diagram, the blue colored curve represents the
final obtained MSK curve.
RESULTS:
8QAM Modulation and Demodulation
Aim: Study QAM Modulation and Demodulation Technique
Equipement Used : HiTech trainer kit
Digital Oscilloscope
Probes and cables
Theory:
Quadrature amplitude modulation (QAM) is the name of a family of digital modulation
methods and a related family of analog modulation methods widely used in modern
telecommunications to transmit information. It conveys two analog message signals, or two
digital bit streams, by changing (modulating) the amplitudes of two carrier waves, using the
amplitude-shift keying (ASK) digital modulation scheme or amplitude modulation (AM)
analog modulation scheme. The two carrier waves are of the same frequency and are out of
phase with each other by 90°, a condition known as orthogonality or quadrature. The
transmitted signal is created by adding the two carrier waves together. At the receiver, the
two waves can be coherently separated (demodulated) because of their orthogonality.
Another key property is that the modulations are low-frequency/low-bandwidth waveforms
compared to the carrier frequency, which is known as the narrowband assumption.
QAM is used extensively as a modulation scheme for digital telecommunication systems,
such as in 802.11 Wi-Fi standards. Arbitrarily high spectral efficiencies can be achieved with
QAM by setting a suitable constellation size, limited only by the noise level and linearity of
the communications channel.QAM is being used in optical fiber systems as bit rates increase;
QAM16 and QAM64 can be optically emulated with a three-path interferometer.
RESULTS:
Convolution Encoder and Decoder