Ec 3501 Wirelss Communication Lab Manual

Download as pdf or txt
Download as pdf or txt
You are on page 1of 34

EC 3501 – WIRELESS COMMUNICATION LABORATORY

1. Modeling of wireless communication systems using Matlab(Two ray channel and Okumura –
Hata model)

2. Modeling and simulation of Multipath fading channel

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

4. Modulation: Spread Spectrum – DSSS Modulation & Demodulation

5. Wireless Channel equalization: Zero-Forcing Equalizer (ZFE),MMSE


Equalizer(MMSEE),Adaptive Equalizer (ADE),Decision Feedback Equalizer (DFE)

6. Modeling and simulation of TDMA, FDMA and CDMA for wireless communication
EX.NO :1 MODELLING OF WIRELSS COMMUNICATION SYSTEMS USING
DATE : MATLAB

a)Two ray channel

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.

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

8.Stop the program.


PROGRAM:

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;

p100 =[p100, 10*log10(power100)];


p30 =[p30, 10*log10(power30)];
p2 =[p2, 10*log10(power2)];
pfsl=[pfsl, 10*log10(fspower)];
end

text('FontSize',18)

semilogx(axis,p100, 'g-',axis,p30, 'b-',axis,p2, 'r-',axis,pfsl,'y-')

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

text(50,-180,'lambda = 0.30 m');


text(50,-190,'hr = 2 m');
OUTPUT:
b)OKUMURA-HATA MODEL

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.

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

8.Stop the program.

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

DATE: Zero-Forcing Equalizer (ZFE)

AIM:

To simulate Wireless Channel Equalization using MATLAB.

APPARATUS REQUIRED :

PC with MATLAB Software

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:

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

8.Stop the program.

ALGORITHM

Simulate the link by following these steps:

1.Generate the number of bits and Eb/No value

2.Modulate BPSK Signal


ZERO FORCING EQUALIZER OUTPUT:

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

8.Stop the program.


PROGRAM:
Clc;
Close all;
Clear all;
%b=input(‘Enter the input bits:’);
b =[1 0 1 0 1 0 1 0 1 0];
ln=length(b);
%converting bit 0 to -1
For i=1:in
If b(i) = = 0
b (i) = -1;
end
end
%Generating the bit sequence with each bit 8 samples long
K=1
for i=1:ln
for j=1:8
bb(k)=b(i);
j=j+1;
k=k+1;
end
i=i+1;
end
len=length(bb);
subplot(2,1,1);
stairs(bb,’Linewidth’,2);
axis([0 len -2 3];
title(‘ORIGINAL BIT SEQUENCE b(t)’);
%Generating the pseudo random bit pattern for spreading
pr_sig=round(rand(1,len));
for i=1:len
if pr_sig(i)==0
pr_sig(i)= -1;
end
end
subplot(2,1,2);
stairs(pr_sig,’Linewidth’,2);
axis([0 len -2 3]);
title(‘PSEUDO RANDOM BIT SEQUENCE pr_sig(t)’);
%Multiplying bit sequence with pseudo random sequence
for i=1:len
bbs(i)=bb(i).*pr_sig(i);
end
%Modulating the hopped signal
class=[];
t=0:1/10:2*pi;
c1=cos(t);
c2=cos(t+pi);
for k=1:len
if bbs(1,k)==-1
dsss=[dsss c1];
else
dsss=[dsss c2];
end
end
figure
subplot(2,1,1);
stairs(bbs,’Linewidth’,2);
axis([0 len -2 3]);
title(‘MULTIPLIER OUTPUT SEQUENCE b(t)*pr_sig(t)’);
subplot(2,1,2);
plot(dsss);
title(‘DS-SS SIGNAL….’);
OUTPUT:

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:

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
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=input('Enter Binary Data In Form of 0 and 1 in [ ] : ');

data=[1 0 0 1 1 0 1 1];

figure('Name','Message BPSK Modulation','NumberTitle','off')

subplot(2,2,1);

plot(rectpulse(data,100));

axis([0 length(rectpulse(data,100)) -0.2 1.2]);

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

title('Message Signal in NRZ form');

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)

title(' BPSK signal');

xlabel('Time Period(t)');

ylabel('x(t)');

axis([0 100*length_data -2 2]);

grid on;

subplot(2,2,4);

plot(real(fft(bpsk_data)));

title('FFT of BPSK signal');

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

figure('Name','PN Generation and CDMA','NumberTitle','off');

subplot(2,2,1);

stem(pn1);

axis([0,length(pn1),-1.2,1.2])

title('PN sequence for data')

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

title('PN sequence for data upsampled');

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

title('FFT of spreaded CDMA Signal');

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

title(sprintf('Tx signal + noise\n SNR=%ddb',sigtonoise));

xlabel('Time Period(t)');

ylabel('x(t)');

grid on;

%Rx

rx=composite_signal.*pnupsampled1;

subplot(2,2,3);

plot(rx);

title('CDMA Demodulated signal');

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

axis([0 length(rectpulse(rxdata,100)) -1.2 1.2]);

title('Recieved Message Signal in NRZ');

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

axis([0 length(rectpulse(rxmsg,100)) -0.2 1.2]);

title('Recieved Message Signal');

xlabel('n');

ylabel('x(n)');

grid on;

sigtonoise1=5;

composite_signal1=awgn(sigtx1,sigtonoise1);

subplot(3,1,2);

plot(composite_signal);

title(sprintf('Tx signal + noise\n SNR=%ddb',sigtonoise1));


xlabel('Time Period(t)');

ylabel('x(t)');

grid on;

sigtonoise2=0;

composite_signal2=awgn(sigtx1,sigtonoise2);

subplot(3,1,3);

plot(composite_signal2);

title(sprintf('Tx signal + noise\n SNR=%ddb',sigtonoise2));

xlabel('Time Period(t)');

ylabel('x(t)');

grid on;

scatterplot(composite_signal); grid minor;

title('Constellation Diagram of BPSK with Noise')

grid on

scatterplot(bpsk_data); grid minor;

title('Constellation Diagram of BPSK')

grid on
OUTPUT:
RESULT:

Thus multiple access techniques in wireless communication has been simulated using matlab.

You might also like