Ec 3501 Wirelss Communication Lab Manual
Ec 3501 Wirelss Communication Lab Manual
Ec 3501 Wirelss Communication Lab Manual
1. Modeling of wireless communication systems using Matlab(Two ray channel and Okumura –
Hata model)
3. Design, analyze and test Wireless standards and evaluate the performance measurements such
as BER, PER, BLER, throughput, capacity, ACLR, EVM for 4G and 5G using Matlab
6. Modeling and simulation of TDMA, FDMA and CDMA for wireless communication
EX.NO :1 MODELLING OF WIRELSS COMMUNICATION SYSTEMS USING
DATE : MATLAB
AIM:
To model and simulate wireless communication system for two ray channel and okumura hata model
using matlab
Software Required:
Matlab version 2014a
THEORY:
The two-rays ground-reflection model is a multipath radio propagation model which predicts
the path losses between a transmitting antenna and a receiving antenna when they are in line of sight
(LOS). Generally, the two antenna each have different height. The received signal having two
components, the LOS component and the reflection component formed predominantly by a single
ground reflected wave. When the distance between antennas is less than the transmitting antenna
height, two waves are added constructively to yield bigger power. As distance increases, these waves
add up constructively and destructively, giving regions of up-fade and down-fade. As the distance
increases beyond the critical distance or first Fresnel zone, the power drops proportionally to an
inverse of fourth power of an approximation to critical distance may be obtained by setting Δφ to π
as the critical distance to a local maximum.
PROCEDURE:
1. Start the MATLAB program.
6. If any error occurs in the program correct the error and run it again
lambda = 0.3;
ht100=100;
ht30=30;
ht2=2;
hr=2;
axis=[];
p100=[];
p30=[];
p2=[];
pfsl=[];
for i=1000:5000
d=10^(i/1000);
axis =[axis d];
fspower = (lambda/(4*3.1415*d))^2 ;
power100 = fspower * 4 *(sin(2*3.1415*hr*ht100/(lambda*d)))^2;
power30 = fspower* 4 *(sin(2*3.1415*hr*ht30/(lambda*d)))^2;
power2 = fspower * 4 *(sin(2*3.1415*hr*ht2/(lambda*d)))^2;
text('FontSize',18)
xlabel('distance in m');
ylabel('pathloss');
text(1000,-66,'blue : hr=30m');
text(1000,-74,'red : hr=2m');
text(1000,-58,'red : hr=100m');
text(1000,-50,'yellow: free space');
PROGRAM
clc;
close all;
clear all;
hte=30:1:100;
hre=input('Enter the receiver antenna height 3m<hre<10m :');
d=input('Enter the distance from base station 1km<d<100km :');
f=input('Enter the frequency 150Mhz<f<1920Mhz :');
c=3*10^8;
lamda=c/(f*10^6);
lf=10*log((lamda^2)/((4*pi)^2));
amu=35;
garea=9;
ghte=20*log(hte/200);
if(hre>3)
ghre=20*log(hre/3);
else
ghre=10*log(hre/3);
end
l50=lf+amu-ghte-ghre-garea;
display('propagation path loss is: ');
disp(l50);
plot(hte,l50,'Linewidth',1.5);
title('okumura model analysis');
xlabel('transmitter antenna height (km)');
ylabel('propagation path loss(db) at 50 km');
grid on;
comparison between okumura and hata model:
OUTPUT:
RESULT:
Thus modeling and Simulation of wireless communication system for two ray channel and okumura -
hata model was done using matlab.
EX.NO 2 MODELLING AND SIMULATION OF MULTIPATH FADING CHANNEL
DATE:
AIM:
To model and simulate multipath fading channel and display the spectral characteristics of the
channel using Rayleigh and Rician multipath fading channel System objects
SOFTWARE REQUIRED:
Matlab version 2014
THEORY:
In wireless communication, fading is a phenomenon in which the strength and quality of a radio
signal fluctuate over time and distance. Fading is caused by a variety of factors, including
multipath propagation, atmospheric conditions, and the movement of objects in the transmission
path. Fading can have a significant impact on the performance of wireless communication systems,
particularly those that operate in high-frequency bands.
Multipath delay spread is a type of small-scale fading that occurs when a transmitted signal
takes multiple paths to reach the receiver.
The different components of the signal can arrive at the receiver at different times, causing
interference and rapid variations in signal amplitude and phase.
Multipath delay spread can cause Inter-Symbol Interference (ISI), where symbols in the
transmitted signal overlap and interfere with each other, leading to errors in the received signal.
The root means square (RMS) delay spread is a measure of the dispersion of the signal and
determines the frequency-selective characteristics of the channel.
A higher RMS delay spread indicates a more frequency-selective channel, while a lower RMS
delay spread indicates a flatter, more frequency-invariant channel.
Multipath delay spread can be mitigated by using techniques such as equalization, diversity,
and adaptive modulation.
Equalization techniques are used to compensate for the time dispersion caused by multipath
delay spread.
Diversity techniques are used to combine multiple signal paths to mitigate the effects of fading.
Adaptive modulation techniques are used to adjust the modulation scheme and data rate based
on the channel conditions, allowing the system to adapt to changes in the channel and maintain
a reliable communication link.
PROCEDURE:
1. Start the MATLAB program.
6. If any error occurs in the program correct the error and run it again
PROGRAM:
%Rayleigh PDF
%Input section
N=1000000;%nUMBER OF SAMPLES TO GENERATE
variance=0.2;
x=randn(1,N);
y=randn(1,N);
%Raleigh feeding envelope with the desired variance
r=sqrt(variance*(x.^2+y.^2));
%Define bin steps and range for histogram plotting
step=0.1;range=0:step:3;
%Get histogram values and approximate it to get the pdf curve
h=hist(r,range);
approxPDF=h/(step*sum(h));%simulation of PDF from the x and y saqmples
%Theoritical PDF from the rayleigh fading equation
theoritical=(range/variance).*exp(-range.^2/(2*variance));
plot(range,approxPDF,'b',range,theoritical,'r');
title('simulated and theoritical Rayleigh PDF from variance=0.5')
legend('simulated PDF,Theoritical PDF')
xlabel('r......>');
ylabel('p(r)...>');
grid;
%PDF of phase of the rayleigh envelope
theta=atan(y./x);
figure(2)
hist(theta);%plot histogram of the phase
%Approximate the histogram of the phase par tto a nice PDF curve
[counts,range]=hist(theta,100);
step=range(2)*range(1);
approx PDF=counts(step*sum(counts));%simulated PDF from x and y samples
bar(range,approxPDF,'b');
holdon
plotHandle=plot(range,approxPDF,'r');
set (plotHandle,'Linewidth',3.5);
axis([-2 2 0 max(approxPDF)+0.2])
holdoff
title('simulated PDF of phase of Rayleigh Distribution');
xlabel('theta.....>');
ylabel('p(\theta)....>');
grid;
OUTPUT:
Result:
Thus the modeling and simulation of multipath fading channel using Rayleigh and Rician channel
system was simulated successfully.
EX.NO:5 WIRELESS CHANNEL EQUALIZATION
AIM:
APPARATUS REQUIRED :
THEORY:
If the modulation bandwidth exceeds the coherent bandwidth of the radio channel ISI occur and
modulation pulses are spread in time. Equalization compensates for ISI(Inter symbol
interference)created by multipath within time dispersive channels. An equalizer within a receiver
compensates for the average range of expected channel amplitude and delay characteristics.
Equalizers can be classified as linear equalizer, non linear equalizer, zero forcing equalizer,
Adaptive equalizer,(MMSE)Minimum mean square error equalizer and decision feedback
equalizer.In zero forcing equalization the equalizer gk attempts to completely inverse the channel
by forcing ck*gk =₰(k-ko).
PROCEDURE:
6. If any error occurs in the program correct the error and run it again
ALGORITHM
RESULT:
Thus channel equalization for wireless channel using zero forcing equalizer has been simulated
using matlab.
EX.NO 4 MODULATION AND DEMODULATION OF DSSS
DATE:
AIM:
To modulate and demodulate Direct sequence spread spectrum using Matlab.
SOFTWARE REQUIRED:
Matlab version 2014
THEORY:
Direct-sequence spread spectrum in Wireless Networks is a technique that transmits a data signal
over a range of frequencies, spreading it uniformly across the allocated spectrum. Direct-sequence
spread spectrum is used to ensure that a particular frequency band (and its corresponding range of
frequencies) is kept free from interference. This technique can be related to escaping the problem
of co-channel interference (like two different wireless networks transmitting on the same
frequency band) and cross-talk interference. Direct-sequence spread spectrum can also be used as
an alternative approach to orthogonal frequency division multiplexing, where the baseband signal
is encoded and transmitted across a quantity of fixed, predetermined channels. In this situation,
each channel may carry different information, data signals, or time slots for different applications
within the same network. Direct-sequence spread spectrum has also been used to transmit data that
is encrypted and, in some processes, it is used to transmit non-data signals like power signaling or
control signals.
Direct Sequence Spread Spectrum (DSSS) is a communication system that divides the bandwidth
of a radio channel into wide frequency bands and transmits these signals over separate frequencies.
In this frequency-hopping process, each signal is assigned a different orthogonal sequence of
frequencies.All other radios in the range must gain each signal sequentially and then transmit it,
which significantly reduces the risk of interference from outside sources or jamming. The time
required for this process is proportional to the number of frequencies used for transmission. When
security agencies need to be ready to communicate secretly, DSSS can be implemented so that
their transmissions cannot be spied upon by other parties who are monitoring broadcasts on a
shorter wavelength or through tapping devices.
PROCEDURE:
1. Start the MATLAB program.
2. Open new M-file
3. Type the program
4. Save in current directory
5. Compile and Run the program
6. If any error occurs in the program correct the error and run it again
7. For the output see command window\ Figure window
RESULT:
Thus modulation and demodulation of DSSS was done using matlab.
EX.NO 6 MODELING AND SIMULATION OF TDMA, FDMA AND CDMA FOR
DATE: WIRELESS COMMUNICATION
AIM:
To model and simulate TDMA,FDMA and CDMA accessing techniques in wireless communication
using Matlab.
SOFTWARE REQUIRED:
Matlab version 2014
THEORY:
Access methods are multiplexing techniques that provide communications services to multiple users
in a single-bandwidth wired or wireless medium. There are five basic access or multiplexing
methods: frequency division multiple access (FDMA), time division multiple access (TDMA), code
division multiple access (CDMA), orthogonal frequency division multiple access (OFDMA), and
spatial division multiple access (SDMA). Each one of these takes advantage of multiplexing
methods, dividing the bandwidth of the signal into different sub-bands, which are then assigned to
different users in order to allow multiple users to share a single channel. Multiplexing is a
communications technique that multiplexes, or combines, multiple signals into a single signal. The
reverse process is called demultiplexing.
In FDMA, the time slots are assigned to the users in a sequential fashion. In TDMA, the time slots
are assigned to the users in a random fashion. In CDMA, the time slots are assigned to the users
based on their code sequences.
FDMA:
FDMA is the process of dividing one channel or bandwidth into multiple individual bands, each for
use by a single user . Each individual band or channel is wide enough to accommodate the signal
spectra of the transmissions to be propagated. The data to be transmitted is modulated on to each
subcarrier, and all of them are linearly mixed together.
TDMA:
TDMA is a digital technique that divides a single channel or band into time slots. Each time slot is
used to transmit one byte or another digital segment of each signal in sequential serial data format.
This technique works well with slow voice data signals, but it’s also useful for compressed video
and other high-speed data.
CDMA:
CDMA is another pure digital technique. It is also known as spread spectrum because it takes the
digitized version of an analog signal and spreads it out over a wider bandwidth at a lower power
level. This method is called direct sequence spread spectrum (DSSS) as well as The digitized and
compressed voice signal in serial data form is spread by processing it in an XOR circuit along with a
chipping signal at a much higher frequency.
PROCEDURE:
6. If any error occurs in the program correct the error and run it again
7. For the output see command window\ Figure window
8.Stop the program.
PROGRAM:
TDMA
clc
clear all;
close all;
num_node=input('Enter number of node for network=');
No_of_time_slots=num_node;
Bandwidth=200; %Khz
time_slots_length=input('Enter the length of time slot');%seconds
Guard_interval=input('Enter the value of guard interval');
for i=1:1:No_of_time_slots
pause(time_slots_length);
a(i)=time_slots_length;
end
endclc;
FDMA
fs=2000;
fm1=4;
fm2=5;
fm3=6;
fcm1=25;
fcm2=50;
fcm3=75;
tiv=1/fs;
t=0:tiv:1;
A=2;
mu=0;
sigma=10;
m1=A*cos(2*pi*fm1*t);
sound(m1,fs);
pause(5);
len=length(m1);
y=lognpdf(mu,sigma);
m1=m1+y';
m2=2*A*cos(2*pi*fm2*t);
m3=3*A*cos(2*pi*fm3*t);
c1=A*cos(2*pi*fcm1*t
c2=A*cos(2*pi*fcm2*t);
c3=A*cos(2*pi*fcm3*t);
x=m1.*c1+m2.*c2+m3.*c3;
x=awgn(x,.02);%adding awgn in channel
[num1,den1]=butter(5,[.5*(fcm1-
fm1),fcm1+fm1]*4/fs);
[num2,den2]=butter(5,[.5*(fcm2-
fm2),fcm2+fm2]*4/fs);
[num3,den3]=butter(5,[.5*(fcm3-
fm3),fcm3+fm3]*4/fs);
filtr1=filter(num1,den1,x);
filtr2=filter(num2,den2,x);
filtr3=filter(num3,den3,x);
lp1=filtr1.*c1;
lp2=filtr2.*c2;
lp3=filtr3.*c3;
[num11,den11]=butter(5,4*fm1/fs);
[num22,den22]=butter(5,4*fm2/fs);
[num33,den33]=butter(5,4*fm3/fs);
lpf_out1=filter(num11,den11,lp1);
lpf_out2=filter(num22,den22,lp2);
lpf_out3=filter(num33,den33,lp3);
subplot(3,3,1);
plot(t,m1);
title('messege signal 1');
grid on;
subplot(3,3,2);
plot(t,m2);title('messege signal 2');
grid on;
subplot(3,3,3);
plot(t,m3);title('messege signal 3');
grid on;
subplot(3,3,4);
plot(t,c1);title('carrier signal 1');
grid on;
subplot(3,3,5);
plot(t,c2);title('carrier signal 2');
grid on;
subplot(3,3,6);
plot(t,c3);title('carrier signal 3');
grid on;
OUTPUT:
CDMA:
close all;
clc;
%N=6;
data=[1 0 0 1 1 0 1 1];
subplot(2,2,1);
plot(rectpulse(data,100));
title('Message Signal');
xlabel('n');
ylabel('x(n)');
grid on;
data(data(:)==0)=-1;
length_data=length(data);
fc1=10;
eb=2;
tb=1;
T=1;
msg=rectpulse(data,100);
subplot(2,2,2);
plot(msg);
xlabel('n');
ylabel('x(n)');
axis([0 100*length_data -1.2 1.2]);
grid on;
N=length_data;
Tb = 0.0001;
nb=100;
br = 1/Tb;
Fc = br*10;
t2 = Tb/nb:Tb/nb:Tb;
t1=0.01:0.01:length_data;
bpskmod=sqrt(2/T)*cos(2*pi*fc1*t1);
bpsk_data=msg.*bpskmod;
subplot(2,2,3)
plot(bpsk_data)
xlabel('Time Period(t)');
ylabel('x(t)');
grid on;
subplot(2,2,4);
plot(real(fft(bpsk_data)));
xlabel('Frequency');
ylabel('PSD');
grid on;
sr=[1 -1 1 -1];
pn1=[];
for i=1:length_data
for j=1:10
pn1=[pn1 sr(4)];
if sr (4)==sr(3)
temp=-1;
else temp=1;
end
sr(4)=sr(3);
sr(3)=sr(2);
sr(2)=sr(1);
sr(1)=temp;
end
end
subplot(2,2,1);
stem(pn1);
axis([0,length(pn1),-1.2,1.2])
xlabel('n');
ylabel('x(n)');
grid on;
pnupsampled1=[];
len_pn1=length(pn1);
for i=1:len_pn1
for j=0.1:0.1:tb
pnupsampled1=[pnupsampled1 pn1(i)];
end
end
length_pnupsampled1=length(pnupsampled1);
subplot(2,2,2)
stem(pnupsampled1);
axis([0,length(pnupsampled1),-1.2,1.2])
xlabel('n');
ylabel('x(n)');
grid on;
subplot(2,2,3);
sigtx1=bpsk_data.*pnupsampled1;
plot(sigtx1);
title('CDMA Signal');
xlabel('Time Period(t)');
ylabel('x(t)');
subplot(2,2,4);
plot(real(fft(sigtx1)));
xlabel('Frequency');
ylabel('PSD');
grid on;
sigtonoise=20;
composite_signal=awgn(sigtx1,sigtonoise);
figure('Name','CDMA Reciever','NumberTitle','off')
subplot(2,2,1);
plot(sigtx1);
title(' Tx Signal');
xlabel('Time Period(t)');
ylabel('x(t)');
grid on;
subplot(2,2,2);
plot(composite_signal);
xlabel('Time Period(t)');
ylabel('x(t)');
grid on;
%Rx
rx=composite_signal.*pnupsampled1;
subplot(2,2,3);
plot(rx);
xlabel('Time Period(t)');
ylabel('x(t)');
grid on;
%BPSK Demodulation
y=[];
bpskdemod=rx.*bpskmod;
for i=1:100:size(bpskdemod,2)
y=[y trapz(t1(i:i+99),bpskdemod(i:i+99))];
end
y(y(:)<=0)=-1;
y(y(:)>=0)=1;
rxdata=y;
subplot(2,2,4);
plot(rectpulse(rxdata,100));
xlabel('n');
ylabel('x(n)');
grid on;
rxdata(rxdata(:)==-1)=0;
rxdata(rxdata(:)==1)=1;
rxmsg=rxdata;
figure('Name','Diffrent SNR','NumberTitle','off')
subplot(3,1,1)
plot(rectpulse(rxmsg,100));
xlabel('n');
ylabel('x(n)');
grid on;
sigtonoise1=5;
composite_signal1=awgn(sigtx1,sigtonoise1);
subplot(3,1,2);
plot(composite_signal);
ylabel('x(t)');
grid on;
sigtonoise2=0;
composite_signal2=awgn(sigtx1,sigtonoise2);
subplot(3,1,3);
plot(composite_signal2);
xlabel('Time Period(t)');
ylabel('x(t)');
grid on;
grid on
grid on
OUTPUT:
RESULT:
Thus multiple access techniques in wireless communication has been simulated using matlab.