0% found this document useful (0 votes)
34 views

Advanced Communication Lab

Uploaded by

mora srinath
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views

Advanced Communication Lab

Uploaded by

mora srinath
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 46

Advanced

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.

Hardware (Kit Based) Experiments


1. FSK Modulation and Demodulation technique
2. MSK –Modulation and Demodulation technique
3. DPSK -Modulation and Demodulation technique
4. QPSK Modulation and Demodulation technique
5. DQPSK Modulation and Demodulation technique
6. 8QAM- Modulation and Demodulation technique
7. Convolution Encoder Decoder

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

modOrder = 16 % for 16-QAM

k = log2(modOrder); % Number of bits per symbol

% Create source bit sequence

srcBits = randi([0,1],numBits,1);

% Perfom 16 QAM Modulation

modOut = qammod(srcBits,modOrder,'InputType','bit', 'UnitAveragePower',true)

% Plot the constellation before noise

scatterplot(modOut);

% ADD Noise

EbNo = 15

chanOut = awgn(modOut,EbNo)

% Plot the constellation after noise addition


scatterplot(chanOut);

% Demodulate the signal

demodOut= qamdemod(chanOut,modOrder,'OutputType','bit','UnitAveragePower',true);

% Calculate Practical BER

isBitError = srcBits~=demodOut

numBitErrors = nnz(isBitError)

BER = numBitErrors/numBits

% Alternative calculation for Practical it Error

[numErrors,ber1] = biterr(srcBits,demodOut);

fprintf('\nThe practical bit error rate is %5.2e, based on %d errors.\n', ...BER,numErrors)

% Calculate theoritical BER

EbNo = 15

bertheo = berawgn(EbNo,'qam',modOrder)

fprintf('\nThetheortical bit error rate is %5.2e',bertheo)

Results:
The theoretical bit error rate is: _ _____________
The practical bit error rate is: _________________

1b ) Plot Theortical BER Vs Practical BER for different values of


Eb/No
% Simulation parameters
numBits = 100000;
modOrder = 16; % for 16-QAM
k = log2(modOrder); % Number of bits per symbol
% Create source bit sequence
srcBits = randi([0,1],numBits,1);
% Perfom 16 QAM Modulation
modOut = qammod(srcBits,modOrder,'bin','InputType','bit',
'UnitAveragePower',true);
% Plot the constellation before noise
scatterplot(modOut);
% ADD Noise
EbNo = 0:1:20;
berVec = zeros(length(EbNo),1);
for n = 1: length(EbNo)
chanOut = awgn(modOut,EbNo(n));
% Plot the constellation after noise addition
%scatterplot(chanOut);
% Demodulate the signal
demodOut=
qamdemod(chanOut,modOrder,'bin','OutputType','bit','UnitAveragePower',true);
% Calculate Practical BER
%isBitError = srcBits~=demodOut
%numBitErrors = nnz(isBitError)
%BER = numBitErrors/numBits
% Alternative calculation for Practical it Error
[numErrors,ber] = biterr(srcBits,demodOut);
berVec(n,1) = ber
end
%fprintf('\nThe practical bit error rate is %5.2e, based on %d errors.\n', ...
BER,numErrors)
%EbNo = 0:1:20
bertheo = berawgn(EbNo,'qam',modOrder)
%fprintf('\nThetheortical bit error rate is %5.2e', bertheo)
semilogy(EbNo,berVec,'*b');
hold on
semilogy(EbNo,bertheo);
grid on
legend('Practical','Theortical');
xlabel('EbNo');
ylabel('BER');
title('Theortical and Practical BER/EbNo for 16QAM');

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:

Guard Bands and Intervals


There are three types of OFDM subcarriers: data, pilot, and null
.Data subcarriers are used for transmitting data while pilot subcarriers are used for
channel estimation.
There is no transmission on null subcarriers, which provide a DC null and provide
buffers between OFDM resource blocks. These buffers are referred to as guard bands
whose purpose is to prevent inter-symbol interference. The allocation of nulls and guard
bands vary depending upon the applicable standard, e.g., 802.11n differs from LTE.
Consequently, the OFDM modulator object allows the user to assign subcarrier indices.
Analogous to the concept of guard bands, the OFDM modulator object supports guard
intervals which are used to provide temporal separation between OFDM symbols so that the
signal does not lose orthogonality due to time-dispersive channels. As long as the guard
interval is longer than the delay spread, each symbol does not interfere with other symbols.
Guard intervals are created by using cyclic prefixes in which the last part of an OFDM
symbol is copied and inserted as the first part of the OFDM symbol. The benefit of cyclic
prefix insertion is maintained as long as the span of the time dispersion does not exceed the
duration of the cyclic prefix. The OFDM modulator object enables the setting of the cyclic
prefix length. The drawback in using a cyclic prefix is the penalty from increased overhead.
PROCEDURE
4. Open Matlab on your PC
5. Open a new live script file(.mlx )
6. Write your code, save and run it

2a. Generate OFDM modulated symbols for use in link-level


simulations.
CODE
%% Create OFDM Modulated Data .

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);

%%Observe the properties of the object created

disp(ofdmMod)

%% % Determine input data, pilot, and output data dimensions.

modDim = info(mod)

%%% Generate random data symbols for the OFDM modulator. The structure variable,

% |modDim|, determines the number of data symbols.

dataIn = complex(randn(modDim.DataInputSize),randn(modDim.DataInputSize));

%% % Create a pilot signal that has the correct dimensions.

pilotIn = complex(rand(modDim.PilotInputSize),rand(modDim.PilotInputSize));

%% % Apply OFDM modulation to the data and pilot signals.

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.

[dataOut, pilotOut] = step(demod,modData);

%% % Verify that, within a tight tolerance, the input data and pilot symbols match
the output data and pilot symbols.

isSame = (max(abs([dataIn(:) - dataOut(:); ...

pilotIn(:) - pilotOut(:)])) < 1e-10)

RESULTS

For 3 symbols

2b OFDM Modulation with the Inverse FFT (Basic link)


numBits = 32768; % power of 2, to optimize performance of fft/ifft
modOrder = 16; % for 16-QAM

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)

2b. SER Simulation for OFDM Link

Aim: To perform a symbol error rate (SER) simulation of an over-the-air OFDM communication
link.

Code.

Create QPSK modulator and demodulator objects.

qpskMod = comm.QPSKModulator;

qpskDemod = comm.QPSKDemodulator;

Create a default OFDM modulator and demodulator pair.

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

data = randi([0 3],nSymbolsPerFrame,1);

% Apply QPSK modulation

txQPSK = qpskMod(data);

% Apply OFDM modulation

txSig = ofdmMod(txQPSK);

% Pass OFDM signal through AWGN channel

rxSig = awgn(txSig,23);

% Demodulate OFDM data

rxQPSK = ofdmDemod(rxSig);

% Demodulate QPSK data

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

3a. DSSS Transmitter and receiver

%System Parameters

d=randi([0,1],10,1)

Rb=10 ;%datarate,
Rc=20;%chiprate and

L=32;%oversamplingfactor

dataLen=length(d)*(Rc/Rb);%required PRBS length to cover the data

%Spreading Sequence

pnSequence =
comm.PNSequence('Polynomial',[3,2,0],'SamplesPerFrame',dataLen,'InitialConditio
ns',[0 0 1]);

prbs = pnSequence()

prbs=prbs(:);

d=d(:);%serialize

%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

%------------BPSK Demodulation---------

r_t = s_t; % Recieved signal

v_t=r_t.*carrier_ref;

x_t=conv(v_t,ones(1,L));%integrate for Tc duration

y=x_t(L:L:end);%sample at ever yLth sample (i.e,every Tc instant);

z=(y>0).'; %Hard decision (gives demodulated bits)

%-----------De-Spreading---------------

y=xor(z,prbs.');%reverse the spreadin gprocess using PRBS ref.

d_cap=y(Rc/Rb:Rc/Rb:end);%sample a tevery Rc/Rb th symbol

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);

title('Demodulted and Despread signal');

3b Performance evaluation DSSS system


%---Inputdata,datarate,chiprate-----

N=10e3;%numberofdatabitstotransmit

d=randi([0,1],N,1)%randomdata

Rb=2e1;%datarate(bps)forthedatad

Rc=6e1;%chip-rate(Rc>>RbANDRcisintegralmultipleofRb)

L=8;%oversamplingfactorforwaveformgeneration

dataLen=length(d)*(Rc/Rb);%required PRBS length to cover the data

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;

x_t=conv(v_t,ones(1,L));%integrate for Tc duration

y=x_t(L:L:end);%sample at ever yLth sample (i.e,every Tc instant);

z=(y>0).'; %Hard decision (gives demodulated bits)

%-----------De-Spreading---------------

y=xor(z,prbs.');%reverse the spreadin gprocess using PRBS ref.

dCap=y(Rc/Rb:Rc/Rb:end);%sample a tevery Rc/Rb th symbol

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');

legend('Practical BER','Theoritical BER')

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.

Rules for drawing MSK Curve

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

You might also like