Lab Manual
Lab Manual
LAB MANUAL
1|Page
INDEX PAGE
2|Page
Current Equipment’s
- Desktop computers
- MATLAB
- MATLAB
3|Page
EXPERIMENT – I
EYE DIAGRAMS
The data eye diagram is a methodology to represent and analyze a high speed
digital signal. The eye diagram allows key parameters of the electrical quality of the
signal to be quickly visualized and determined. The data eye diagram is constructed
from a digital waveform by folding the parts of the waveform corresponding to each
individual bit into a single graph with signal amplitude on the vertical axis and time
on horizontal axis.
By repeating this construction over many samples of the waveform, the resultant
graph will represent the average statistics of the signal and will resemble an eye.
4|Page
Objective:
Illustrate the use of the eye diagram for finding the best decision point.
Theory:
The code below illustrates the use of the eye diagram for finding the best decision
point. It maps a random digital signal to a 16-QASK waveform, and then uses a raised
cosine filter to simulate a noisy transmission channel. Several commands manipulate
the filtered data to isolate its steady- state behaviour.
Program:
% Define the M-ary number and sampling rates.
M = 16; Fd = 1; Fs = 10;
h1 = eyediagram(rcv1,N,1/Fd,offset1);
set(h1,'Name','Eye Diagram Displayed with No Offset');
5|Page
Program 2:
Plot the eye diagram of the sampled signal with the offset of 2.
offset2 = 2;
h2 = eyediagram(rcv1,N,1/Fd,offset2,'r-'); set(h2,'Name','Eye
Diagram Displayed with Offset of Two');
Output:
6|Page
EXPERIMENT – II
7|Page
Objective: To generate data and apply fading channels. Also compute error rate for
different values of Sound to Noise ratio (SNR) and hence plot it’s Bit Error Rate
(BER).
Program:
c = rayleighchan(1/10000,100);
sig = 1i*ones(2000,1); % Generate signal
y = filter(c,sig); % Pass signal through channel
c % Display all properties of the channel
c=
ChannelType: 'Rayleigh'
InputSamplePeriod: 1.0000e-004
DopplerSpectrum: [1x1
doppler.jakes] MaxDopplerShift:
100
PathDelays: 0
AvgPathGaindB: 0
NormalizePathGains: 1
StoreHistory: 0
StorePathGains: 0 PathGains:
0.9155 - 0.8059i
ChannelFilterDelay: 0
ResetBeforeFiltering: 1
NumSamplesProcessed: 2000
Output
9|Page
EXPERIMENT – III
Objective: To determine the free space loss and the power received using Matlab program.
Theory:
The free space path loss, also known as FSPL is the loss in signal strength
that occurs when an electromagnetic wave travels over a line of sight path in free
space. In these circumstances there are no obstacles that might cause the signal to
be reflected refracted, or that might cause additional attenuation.
The free space path loss calculations only look at the loss of the path itself
and do not contain any factors relating to the transmitter power, antenna gains or
the receiver sensitivity levels.
To understand the reasons for the free space path loss, it is possible to
imagine a signal spreading out from a transmitter. It will move away from the
source spreading out in the form of a sphere. As it does so, the surface area of the
sphere increases. As this will follow the law of the conservation of energy, as the
surface area of the sphere increases, so the intensity of the signal must decrease.
As a result of this it is found that the signal decreases in a way that is inversely
proportional to the square of the distance from the source of the radio signal
The free space path loss formula or free space path loss equation is quite
simple to use. Not only is the path loss proportional to the square of the
distance between the transmitter and receiver, but the signal level is also
proportional to the square of the frequency in use.
FSPL = (4πd/ λ)2 = (4πdf/ c)2
FSPL is the Free space path loss d is the distance of the receiver from the
transmitter (metres) λ is the signal wavelength (meters) f is the signal frequency
(Hertz) c is the speed of light in a vacuum (meters per second)
The free space path loss formula is applicable to situations where only the
electromagnetic wave is present, i.e. for far field situations. It does not hold true for
near field situations.
10 | P a g e
Decibel version of free space path loss equation
Most RF comparisons and measurements are performed in decibels. This gives an
easy and consistent method to compare the signal levels present at various points.
Accordingly it is very convenient to express the free space path loss formula, FSPL,
in terms of decibels..
The free space path loss equation or formula given above, is an essential tool that is
required when making calculations for radio and wireless systems either manually
or within applications such as wireless survey tools, etc. By using the free space path
loss equation, it is possible to determine the signal strengths that may be expected
in many scenarios. While the free space path loss formula is not fully applicable
where there are other interactions, e.g. reflection, refraction, etc as are present in
most real life applications, the equation can nevertheless be used to give an
indication of what may be expected. It is obviously fully applicable to satellite
systems where the paths conform closely to the totally free space scenarios
Power Received :
11 | P a g e
Program:
clc;
close
all;
clear
all;
f=input('enter the frequency in Mhz: ');
L=300/f; %calculating wavelength
disp('thus the wavelength is: ');
L %displaying wavelength
d=input('enter the distance in km: ');
Gt=input('enter the transmitting antenna gain in db: ');
Gr=input('enter the receiving antenna gain in db: ');
Result:
The program for power received by an antenna and path loss in Free space
propagation was simulated successfully.
12 | P a g e
EXPERIMENT 4
LINK BUDGET EQUATION – SATELLITE COMMUNICATION
Aim :
To write a Matlab program to calculate the link budget for satellite communication.
Theory :
A link budget is an accounting of all the gains and losses in a transmission system. The link
budget looks at the elements that will determine the signal strength arriving at the receiver. The
link budget may include the following items:
Tansmitter power.
Atenna gains (receiver and transmitter).
Antenna feeder losses (receiver and transmitter).
Path losses.
Receiver sensitivity (although this is not part of the actual link budget, it is necessary to
know this to enable any pass fail criteria to be applied.
Where the losses may vary with time, e.g. fading, and allowance must be made within the
link budget for this - often the worst case may be taken, or alternatively an acceptance of periods
of increased bit error rate (for digital signals) or degraded signal to noise ratio for analogue
systems.
Received power (dBm) = Transmitted power (dBm) + gains (db) - losses (dB)
The basic calculation to determine the link budget is quite straightforward. It is mainly a
matter of accounting for all the different losses and gains between the transmitter and the
receiver.
Losses = FSL + AML + RFL + PL + AA
FSL = Freespace loss AML = Antenna Misalignment loss
RFL=Receiver Feeder loss PL=Polarization Loss
AA = Atmospheric Absorption.
13 | P a g e
Carrier to Noise Ratio – Uplink
CNRu=EIRPu+GTRu-Lossu+228.6
Carrier to Noise Ratio – Uplink
CNRd=EIRPd+GTR-Lossd+228.6
Overall Carrier to Noise Ratio
CNRoverall=CNRu X CNRd / (CNRu+CNRd)
Program:
clc;
close all;
clear all;
pt=input('enter the input power in watts:');
Pt=10*log10(pt) %calculating transmitted power in db
gt=input('enter the transmitting antenna gain in db:');
gs=input('enter the recieving antenna gain in db:');
EIRP=Pt+gt %calculating EIRP
d=input('enter the distance in km:');
f=input('enter the frequency in mhz:');
fsl=32.4+20*log10(d)+20*log10(f) %calculating path loss
rfl=input('enter the reciever feeder loss in db:');
aa=input('enter the atmospheric absorption in db:');
aml=input('enter the antenna misalignment loss in db:');
pl=input('enter the polarization loss in db:');
losses=fsl+rfl+aa+aml+pl; %calculating total losses
disp(sprintf('%s %f %s','total loss',losses,'db'));
P=EIRP+gs-losses; %calculating power recieved
disp(sprintf('%s %f %s','Total recieved power =',P,'db'));
Result:
The Matlab program for calculating the link budget was simulated successfully
14 | P a g e
Experiment 5
As the path loss encountered along any radio link serves as the dominant
factor for characterization of propagation for the link, radio propagation models
typically focus on realization of the path loss with the auxiliary task of predicting
the area of coverage for a transmitter or modeling the distribution of signals over
different regions.
Because each individual telecommunication link has to encounter different
terrain, path, obstructions, atmospheric conditions and other phenomena, it is
intractable to formulate the exact loss for all telecommunication systems in a single
mathematical equation. As a result, different models exist for different types of
radio links under different conditions. The models rely on computing the median
path loss for a link under a certain probability that the considered conditions will
occur. Different models have been developed to meet the needs of realizing the
propagation behavior in different conditions.
15 | P a g e
OKUMURA MODEL
Objective: To write a Matlab program to calculate the median path loss for
Okumura model for outdoor propagation.
Theory:
The Okumura model for Urban Areas is a Radio propagation model that was built
using the data collected in the city of Tokyo, Japan. The model is ideal for using in
cities with many urban structures but not many tall blocking structures. The model
served as a base for the Hata Model.
Okumura model was built into three modes. The ones for urban, suburban and open
areas. The model for urban areas was built first and used as the base for others.
Coverage
Frequency = 150 MHz to 1920 MHz
Mobile Station Antenna Height: between 1 m and 10
m Base station Antenna Height: between 30 m and
1000 m Link distance: between 1 km and 100 km
Mathematical formulation
The Okumura model is formally expressed as:
L = LFSL + AMU – HMG – HBG – Σ KCORRECTION
where,
L = The median path loss. Unit: Decibel (dB)
LFSL = The Free Space Loss. Unit: Decibel(dB)
AMU = Median attenuation.Unit: Decibel(dB)
HMG = Mobile station antenna height gain factor.
HBG = Base station antenna height gain factor.
Kcorrection = Correction factor gain (such as type of environment, water
surfaces, isolated obstacle etc.)
Okumura model does not provide a mean to measure the Free space loss.
However, any standard method for calculating the free space loss can be
used.
16 | P a g e
Program:
clc; clear all;
close all;
Lfsl=input('enter the free space loss:');
Amu=input('enter the median attenuation value:');
Hmg=input('enter the Mobile station antenna height gain factor:');
Hbg=input('enter the Base station antenna height gain factor:');
Kc=input('enter the Correction factor gain:');
L=Lfsl+Amu-Hmg-Hbg-Kc; %calculating median path loss
disp(sprintf('%s %f %s','the median path loss:',L,'dB'));
Result:
The program for Okumura Model – Outdoor Propagation was simulated successfully.
17 | P a g e
HATA MODEL
Objective: To write a Matlab program to calculate the median path loss for Hata
model for outdoor propagation.
Theory:
In wireless communication, the Hata Model for Urban Areas, also known as the Okumura-
Hata model for being a developed version of the Okumura Model, is the most widely used
radio frequency propagation model for predicting the behaviour of cellular transmissions
in built up areas. This model incorporates the graphical information from Okumura model
and develops it further to realize the effects of diffraction, reflection and scattering caused
by city structures. This model also has two more varieties for transmission in Suburban
Areas and Open Areas.
Hata Model predicts the total path loss along a link of terrestrial microwave or other
type of cellular communications. This particular version of the Hata model is applicable
to the radio propagation within urban areas. This model is suited for both point-to-point
and broadcast transmissions and it is based on extensive empirical measurements
taken.PCS is another extension of the Hata model. The Walfisch and Bertoni Model is
further advanced.
Coverage:
- Frequency: 150 MHz to 1500 MHz
- Mobile Station Antenna Height: between 1 m and 10 m Base station
Antenna Height: between 30 m and 200 m
- Link distance: between 1 km and 20 km.
Mathematical formulation
Hata Model for Urban Areas is formulated as:
LU = 69.55 + 26.16 log f – 13.82 log hB – CH + [ 44.9 – 6.55 log hB] log d.
For small or medium sized city,
18 | P a g e
Where,
- LU = Path loss in Urban Areas (dB)
- hB= Height of base station Antenna. (m)
- hM = Height of mobile station Antenna. (m)
- f= Frequency of Transmission (MHz).
- CH = Antenna height correction factor
- d= Distance between the base and mobile stations (km).
- The term "small city" means a city where the mobile antenna height not more than
10 meters. i.e. 1 ≤ hM ≤ 10m
Program:
clc; clear all;
close all;
f=input('enter the frequency of transmisson in mhz:');
Hb=input('enter the height of base station Antenna in meter:');
Hm=input('enter the height of mobile station Antenna in meter:');
d=input('enter the distance between the base and mobile stations:');
n=input('enter 0 for small city and 1 for large city:');
if n==0
ch=0.8+(1.1*log10(f)-0.7)*Hm-1.56*log10(f); else
if f>=150 && f<=200 ch=8.29*(log10(1.54*Hm))^.2-1.1;
else
if f>=200 && f<=1500
ch=3.2*(log10(11.75*Hm))^.2- 4.97;
end;
end;
end;
Lu=69.55+26.26*log10(f)-13.82*log10(Hb)-ch+(44.9-.55*log10(Hb))*log10(d);
disp(sprintf('%s %f %s','Path loss in Urban Areas=',Lu,'db'));
Result:
The program for Hata Model – Outdoor Propagation was simulated successfully.
19 | P a g e
EXPERIMENT – VI
Theory:
BPSK is a change in the phase signal that is used to transmit binary messages. BPSK is
most simple form of Phase shift keying.
Note: Phase shift keying is a digital modulation scheme that conveys data by changing,
or modulating, the phase of a reference signal.
Generation of BPSK
Sinusoidal carrier wave is modulated by b-polar bit stream. It’s polarity will be
reversed every time the bit stream changes polarity.
20 | P a g e
BPSK Signal in time domain
The wave shape is ‘symmetrical’ at each phase transition. This is because the bit rate
is a sub- multiple of the carrier frequency ω/(2π). In addition, the message
transitions have been timed to occur at a zero-crossing of the carrier.
MATLAB Code:
SNR=10.^(SNRdB/10);
avgError=0;
waitbar((((count-1)*max_run)+run_time-
1)/(length(SNRdB)*max_run)); Error=0;
for k=1:num_bit %Decision device taking hard decision and deciding error
if ((Y(k)>0 && data(k)==0)||(Y(k)<0 && data(k)==1))
Error=Error+1;
end
end
close(hand);
semilogy(SNRdB,BER_th,'k'); %Plot
BER hold on
semilogy(SNRdB,BER_sim,'k*');
legend('Theoretical','Simulation',3);
hold off
22 | P a g e
Output:
23 | P a g e
EXPERIMENT – VII
Objective: Simulate a QPSK modulation scheme and design the constellation diagram
by showing the four basic QPSK angles.
Theory:
QPSK (Quadrature Phase Shift Keying) is type of phase shift keying. Unlike BPSK
which is a DSBCS modulation scheme with digital information for the message, QPSK
is also a DSBCS modulation scheme but it sends two bits of digital information a
time (without the use of another carrier frequency).
Note: The amount of radio frequency spectrum required to transmit QPSK reliably
is half that required for BPSK signals, which in turn makes room for more users on
the channel.
24 | P a g e
Generation of a QPSK signal:
Figure below shows the block diagram of the mathematical implementation of QPSK.
At the input of the modulator, the digital data’s even bits (i.e., bits 0,2,4 and so on)
are stripped from the data stream by a “bit-splitter” and are multiplied with a
carrier to generate a BPSK signal (called PSKI). At the same time, the data’s odd bits
(i.e., bits 1,3,5 and so on) are stripped from the data stream and are multiplied with
the same carrier to generate a second BPSK signal (called PSKQ). However, the PSKQ
signal’s carrier is phase shifted by 90o before being modulated.
The two BPSK signals are then simply added together for transmission and, as they
have the same carrier frequency, they occupy the same portion of the radio
frequency spectrum. While this suggests that the two sets of signals would be
irretrievably mixed, the required 90o of phase separation between the carriers
allows the sidebands to be separated by the receiver using phase discrimination.
The constellation diagram of QPSK is as shown below:
25 | P a g e
With four phases, QPSK can encode two bits per symbol shown in the diagram to
minimize the BER- twice the rate of BPSK. Analysis shows that this may be used
either to double the data rate compared to a BPSK system while maintaining the
bandwidth of the signal or to maintain the data rate of BPSK but half the bandwidth
needed.
Writing the symbols in the constellation diagram in terms of sine and cosine waves
used to transmit them. This yields the four phase’s π/4, 3π/4, 5π/4 and 7π/4 as
needed. This results in a two dimensional signal space with unit basis functions. The
first basis function is used as the in- phase component of the signal and the second
as the quadrature component of the signal. Hence the signal constellation consists of
the signal- space 4 points.
26 | P a g e
27 | P a g e
28 | P a g e
EXPERIMENT – VIII
DELTA MODULATION/DEMODULATION
Theory:-
29 | P a g e
Program:
clc;
clear all;
close all;
a=2;
t=0:2*pi/50:2*pi;
x=a*sin(t);
l=length(x);
plot(x,'r');
delta=0.2;
hold on
xn=0;
for i=1:l;
if x(i)>xn(i)
d(i)=1;
xn(i+1)=xn(i)+delta;
else
d(i)=0;
xn(i+1)=xn(i)-delta;
end
end stairs(xn)
hold on
for i=1:d
if d(i)>xn(i)
d(i)=0;
xn(i+1)=xn(i)-delta;
else
d(i)=1;
xn(i+1)=xn(i)+delta;
end
end plot(xn,'c');
legend('Analog signal','Delta modulation','Demodulation')
title('DELTA MODULATION / DEMODULATION ')
30 | P a g e
Output:
Result: The program to simulate Delta Modulation/ Demodulation has been completed and
plotted successfully.
31 | P a g e
EXPERIMENT –IX
Objective:
To study the relationship between the signal power Eb/N0, Bit Error Rate BER with
different bit rate in BPSK,QPSK, 8 QAM, 16QAM by using BER Analyzing tool in
Matlab.
Description:
- BPSK :
Number of bits = 1
Number of angles = 2
BPSK constellation diagram:
- QPSK :
Number of bits = 2
Number of angles
=4
QPSK constellation diagram:
- 8QAM :
Number of bits = 3
Number of symbols = 8
8QAM constellation diagram:
- 16 QAM:
Number of bits = 4
Number of Symbols = 16
16QAM constellation diagram:
32 | P a g e
Case Study: we are using BER tool to show many
33 | P a g e
Comparison Table:
34 | P a g e
35
EXPERIMENT – X
Objective:
Theory:
The basic measure of performance is the capacity of a channel: the maximum rate of
communication for which arbitrarily small error probability can be achieved. AWGN
(Additive White Gaussian Noise) channel is then used as a building block to study the
capacity of wireless fading channels.
Where x[m] and y[m] are real input and output at time m respectively and w[m]is N,
noise, independent over time.
Matlab Code:
Introducing AWGN
fs = 10^5; N = 10^5;
t = 1/fs:1/fs:N/fs; fm = 2;
fc = 10^3;
m = sin(2*pi*fm*t);
c = sin(2*pi*fc*t);
v = m.*c;
SNRdB = 10;
SNR = 10^(SNRdB/10);
35 | P a g e
36
vn = var(v)/SNR;
n = sqrt(vn)*randn(1,N);
v = v + n;
r=zeros(1,N);
n=fs/fc;
for k=1: fc
mr((k-1)*n+1:k*n)=2*v((k-1)*n+1:k*n)*c((k- 1)*n+1:k*n)'/n;
end
figure(1)
subplot(2,1,1); plot(t,m);
36 | P a g e
37
EXPERIMENT – XI
o Viterbi Equalizer: Finds the maximum likelihood (ML) optimal solution to the
equalization problem. Its goal is to minimize the probability of making an error
over the entire sequence.
Objective: Plot the un-equalized channel frequency response, and the BER of an
ideal BPSK system using MLSE equalizer parameters.
Theory:
37 | P a g e
38
Program:
38 | P a g e
39
39 | P a g e
40
40 | P a g e
41
41 | P a g e
42
EXPERIMENT – XII
Direct sequence contrasts with the other spread spectrum process, known as
frequency hopping spread spectrum, or Frequency Hopping Code Division Multiple
Access (FH-CDMA), in which a broad slice of the bandwidth spectrum is divided into
many possible broadcast frequencies. In general, frequency-hopping devices use less
power and are cheaper, but the performance of DS- CDMA systems is usually better
and more reliable.
In recent years, researchers have turned their attention to applying spread spectrum
processes for commercial purposes, especially in local area wireless networks.
42 | P a g e
43
Theory:
In Direct Sequence spread spectrum transmission, the user data signal is multiplied by
a code sequence. Mostly, binary sequences are used. The duration of an element in the
code is called the "chip time". The ratio between the user symbol time and the chip
time is called the spread factor. The transmit signal occupies a bandwidth that equals
the spread factor times the bandwidth of the user data.
In the receiver, the received signal is again multiplied by the same (synchronized)
code. This operation removes the code, so we recover the transmitted user data. A
CDMA receiver can retrieve the wanted signal by multiplying the receive signal with
the same code as the one used during transmission. We find:
Where, c1 is the code sequence used by user 1, Tc is the chip duration, td is a common
time offset, shared between transmitter and receiver and N is the length of the code
sequence.. Note that the receive code must be perfectly time aligned with the transmit
code
43 | P a g e
44
Program:
clear all;
close all;
clc;
%% Deciding the Number of users and the Number of bits for each user (same
%% for all users)
x= input ('Number of users =');
y=input('Number of Bits for each user = ');
r=log(x)/log(2)
for t = 1 : x
u=[u; (randint(1,y,2)*2-1)];
m=[m ; (kron(u(t,:),wmmsnn(t,:)))];
end
y2 =rectpulse(mms,r);
for n=1:numsnr
mmsn2=awgn(y2,snrloop(n),'measured');
44 | P a g e
45
mmsn=intdump(mmsn2,r);
mmsn=dp_nrz_L(mmsn7);
end
outmsg=[];
for rb=1:x
g1=kron(g,wmmsnn(rb,:));
r1= g1.*mmsn;
rr1=reshape(r1,x,length(r1)/x);
k1=sum(rr1);
u11=k1>0;
outmsg=[outmsg;u11];
end
45 | P a g e
46
EXPERIMENT – XIII
CONVOLUTIONAL CODING
The difference between block codes and convolutional codes is the encoding principle.
In the block codes, the information bits are followed by the parity bits. In
convolutional codes the information bits are spread along the sequence. That means
that the convolutional codes map information to code bits not block wise, but
sequentially convolve the sequence of information bits according to some rule. The
code is defined by the circuit, which consists of different number of shift registers
allowing building different codes in terms of complexity.
46 | P a g e
47
Theory:
The idea of puncturing is to delete some bits in the code bit sequence according to a
fixed rule. In general the puncturing of a rate K / N code is defined using N puncturing
vectors. Each table contains p bits, where p is the puncturing period. If a bit is 1 then
the corresponding code bit is not deleted, if the bit is 0, the corresponding code bit is
deleted. The N puncturing vectors are combined in a N * p puncturing matrix P.
Program:
len = 30000; msg = randi([0 1], len, 1); % Random
data t = poly2trellis(7, [133 171]); % Define
trellis.
punctcode = convenc(msg, t, [1 1 1 0 0 1]); % Length is (2*len)*2/3.
tcode = 1-2*punctcode; % Map "0" bit to 1 and "1" bit
to -1 ncode = awgn(tcode, 3, 'measured'); % Add noise.
47 | P a g e
48
Program:
Output:
num =
2252
ber =
0.045
**************************************
48 | P a g e