0% found this document useful (0 votes)
4 views30 pages

Wireless Comm

This document is a bonafide certificate for a student of Anna University, detailing their work in the Wireless Communication Laboratory. It includes various experiments conducted using MATLAB, such as modeling wireless communication systems, simulating multipath fading channels, and implementing DSSS modulation and demodulation. The document concludes with results from multiple experiments demonstrating the application of different wireless communication techniques.

Uploaded by

raonerahul001
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)
4 views30 pages

Wireless Comm

This document is a bonafide certificate for a student of Anna University, detailing their work in the Wireless Communication Laboratory. It includes various experiments conducted using MATLAB, such as modeling wireless communication systems, simulating multipath fading channels, and implementing DSSS modulation and demodulation. The document concludes with results from multiple experiments demonstrating the application of different wireless communication techniques.

Uploaded by

raonerahul001
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/ 30

ANNA UNIVERSITY REGIONAL CAMPUS

KEELAKUILKUDI

MADURAI-625019

BONAFIDE CERTIFICATE

It is hereby certified that this is the bonafide record of work done by


_____________________ of Fifth semester, BE Department of Electronics
and Communication Engineering in EC3501 - Wireless Communication
Laboratory.

Staff-In-Charge HOD

Submitted for Wireless Communication Laboratory Practical Examination


held on _____________ at Anna university regional campus Madurai.

Register Number:

Internal Examiner External Examiner

1
2
INDEX
S.No Date Name of Experiment Pg. No Marks Signature

3
4
Exp. No:
Modelling of wireless communication systems using MatLab
Date:

AIM:
To design a model of wireless communication systems using Matlab (Two ray
ground reflection Model and Okumura-Hata Model).

PROGRAM:

1. Program for Two ray ground reflection model:


2. %Program to implement Two ray ground reflection model
3. Pt=input('Transmitted power by transmitter:');
4. Gt= input('Transmitter antenna Gain:');
5. Gr=input('Receiver antenna Gain:');
6. Ht=input('Transmitter height (in mts):');
7. Hr=input('Receiver height (in mts):');
8. D=input('Distance between transmitter and receiver (in mts):');
9. p=[];
10. for d=1:D
11. Pr=Pt*Gt*Gr*((Ht*Hr)^2)/d^4;
12. p=cat(1,p,log10(Pr));
13. end
14. semilogx((1:D),p);
15. xlabel('Distance in meters')
16. ylabel('Received Power in dB')
17. title('Two Ray Ground Reflection Model')

2. Program for Okumura-Hata model:

%Program to implement Okumura-Hata Model


clc;
clear all;
close all;
hte=30;
d=1:1:4;
hre=input('Enter the receiver antenna height 3m<hre<10m:');
f=input('Enter the frequency 150MHz<f<1920Mhz:');
disp('For Hata Model');
aHr=input('Correction factor in dB:');
c=3*10^8;
lamda=c/(f*10^6);
lf=10*log((lamda^2)/((4*pi)^2));
amu=[16 17 18 19];
garea=9;
ghte=20*log(hte/200);
if (hre>3)
ghre=20*log(hre/3);
else
ghre=10*log(hre/3);
end

5
for i= 0:3
l50=lf+amu-ghte-ghre-garea;
end
display('Prapagation path loss is: ');
disp(l50);
figure(2);
plot(d,l50,'LineWidth',1.5);
title('Okumura Model Analysis');
xlabel('Transmitter antenna height (km):');
ylabel('Propagation path loss(dB) at 50 km:');
grid on;
%hata model
p=[];
for D=1:4
pL=69.55+26.16*log10(f)-13.82*log10(hte)-aHr+(44.9-6.55*log10(hte))*log10(D);
p=cat(1,p,pL);
end
figure (1);
plot(d,p);
xlabel('Distance in meters');
ylabel('Path Loss in dB');
title('Hata Pathloss Model');

6
Output:

7
Result:

Hence, Wireless communication systems were modelled using Matlab by implementing


two ray ground reflection and Okumura-Hata Model.

8
9
Exp. No:
Modelling and simulation of Multipath fading channel
Date:

AIM:
To model and simulate a multipath fading channel using Rayleigh fading model.

PROGRAM:

N=input('Enter the number of samples:');


SNR_dB=input('Enter the snr of the channel in dB:');
noise=(randn(1,N)+1i*randn(1,N))/sqrt(2);
cf=(randn(1,N)+1i*randn(1,N))/sqrt(2);
x=(randn(1,N)+1i*randn(1,N))/sqrt(2);
SNR=10^(SNR_dB/10);
y=cf.*x+sqrt(1/(2*SNR)).*noise;
SNR_received=abs(cf.*x).^2/abs(sqrt(1/(2*SNR))*noise).^2;
variance=0.2;
r=sqrt(variance*(x.^2+y.^2));
step=0.1;range=0:step:3;
h=hist(r,range);
approxPDF=h/(step*sum(h));
theoretical=(range/variance).*exp(-range.^2/(2*variance));
figure(1);
plot(range,approxPDF,'b',range,theoretical,'r');
title('Simulated and theoretical Rayleigh PDF from variance=0.5');
legend('Simulated PDF,Theoretical PDF');
xlabel('r---->');
ylabel('p(r)--->');
figure(2);
subplot(2,1,1);
plot(real(y));
title('Real part of received signal');
subplot(2,1,2);
plot(imag(y));
title('Imaginary part of received signal');

OUTPUT:

10
11
RESULT:
Hence, a multipath fading channel (Rayleigh fading) has been implemented
through MatLab.

12
Exp. No:
Spread Spectrum – DSSS Modulation & Demodulation
Date:

AIM:
To modulate and demodulate a signal through spread spectrum-DSSS.

PROGRAM:
clc;
clear;
b=round(rand(1,30));
pattern=[];
for k=1:30
if b(1,k)==0
sig=-ones(1,20);
else
sig=ones(1,20);
end
pattern=[pattern sig];
end
subplot(4,2,1);
plot(pattern);
axis([-1 620 -1.5 1.5]);
title('Original bit sequence');
xlabel('Time');
ylabel('Amplitude');
d=round(rand(1,120));
pn_seq=[];
carrier=[];
t=1:1:600;
for k=1:120
if d(1,k)==0
sig=-ones(1,5);
else
sig=ones(1,5);
end
c=cos(t);
pn_seq=[pn_seq sig];
end
spreaded_sig=pattern.*pn_seq;
subplot(4,2,2);
plot(spreaded_sig);
title('Spreaded signal');
xlabel('Time');
ylabel('Amplitude');
bpsk_sig=spreaded_sig.*c;
subplot(4,2,3);
plot(bpsk_sig);
title('bpsk modulated signal');
xlabel('Time');
ylabel('Amplitude');
y=abs(fft(xcorr(bpsk_sig)));
subplot(4,2,8);
plot(y/max(y));
title('FFT of DSSS signal');
xlabel('Frequency');
ylabel('PSD');

13
rxsig=bpsk_sig.*c;
demod_sig=[];
for i=1:600
if rxsig(i)>=0
rxs=1;
else
rxs=-1;
end
demod_sig=[demod_sig rxs];
end
subplot(4,2,5);
plot(demod_sig);
title('domodulated signal');
xlabel('Time');
ylabel('Amplitude');
despread_sig=demod_sig.*pn_seq;
subplot(4,2,6);
plot(despread_sig);
title('despreaded signal');
xlabel('Time');
ylabel('Amplitude');
z=0.5+0.5*despread_sig;
y=abs(fft(xcorr(z)));
subplot(4,2,7);
plot(y/max(y));
title('Power spectrum of despreaded data');
xlabel('Frequency');
ylabel('PSD');
subplot(4,2,4);
plot(c);
title('carrier signal');
xlabel('Time');
ylabel('Amplitude');

14
OUTPUT:

15
RESULT:
Hence, DSSS modulation and demodulation were implemented to a given data
sequence.

16
Exp. No:
Wireless Channel equalization
Date:

AIM:
To perform wireless channel equalization by implementing zero-forcing
equalizer and adaptive equalizer.

PROGRAM:
1. Zero Forcing equalizer:

N = input(‘Enter number of transmitted symbols: ’);

SNR_dB =input(‘Enter SNR in dB: ’);

channel_coeff =input(‘Enter channel coefficient: ’);

tx_symbols = randi([0, 1], 1,N);

tx_signal = 2 * tx_symbols - 1;

rx_signal = channel_coeff * tx_signal;

snr = 10^(SNR_dB / 10);

Pnoise = 1 / (2 * snr);

noise = sqrt(Pnoise) * randn(size(rx_signal));

rx_signal = rx_signal + noise;

equalized_signal = rx_signal / channel_coeff;

% Demodulate the received signal (detect symbols)

rx_symbols = sign(equalized_signal);

num_errors = sum(rx_symbols ~= tx_symbols);

ber = num_errors / N;

17
OUTPUT:

18
fprintf('Bit Error Rate (BER) with Zero Forcing Equalizer: %f\n', ber);

2. Adaptive Equalizer:

channel_length = input(‘Enter length of the impulse response: ’);

SNR_dB=input(‘Enter SNR of the channel in dB: ’);

N=input(‘Enter number of symbols to transmit: ’);

mu=0.01;

data_symbols = randi([0, 1], 1,N);

modulated_symbols = 2 * data_symbols - 1;

channel = (randn(1, channel_length) + 1i * randn(1, channel_length)) / sqrt(2);

received_symbols = filter(channel, 1, modulated_symbols);

Pnoise = 10^(-SNR_dB / 10);

noise = sqrt(Pnoise) * (randn(1, length(received_symbols)) + 1i *


randn(1, length(received_symbols)));

received_symbols_noisy = received_symbols + noise;

equalizer_length = channel_length;

equalizer = zeros(1, equalizer_length);

output_signal = zeros(1, length(received_symbols_noisy));

for i = equalizer_length:length(received_symbols_noisy)

received_window = received_symbols_noisy(i:-1:i-
equalizer_length+1);

output_signal(i) = equalizer * received_window.';

error = modulated_symbols(i) - output_signal(i);

equalizer = equalizer + mu * conj(error) * received_window;

end

demodulated_symbols = real(output_signal) > 0;

ber = sum(data_symbols ~= demodulated_symbols) / N;

disp(['Bit Error Rate (BER): ', num2str(ber)]);

19
OUTPUT:

20
RESULT:
Thus, zero-forcing and adaptive equalizations were implemented for a given
channel.

21
22
Exp. No:
Modelling and simulation of TDMA, FDMA and CDMA for
wireless communication
Date:

AIM:
To model and simulate TDMA, FDMA and CDMA for wireless communication.
PROGRAM:
1. TDMA:

numUsers = 4;

numSlots = 10;

snr_dB = 20;

user_data = randi([0, 1], numUsers, numSlots);

transmitted_signal = zeros(1, numSlots);

for slot = 1:numSlots

for user = 1:numUsers

transmitted_signal(slot) = transmitted_signal(slot) +
user_data(user, slot);

end

end

SNR = 10^(snr_dB/10);

noise_power = 0.5 / SNR;

noise = sqrt(noise_power) * randn(1, numSlots);

received_signal = transmitted_signal + noise;

received_data = zeros(numUsers, numSlots);

23
OUTPUT:

24
for slot = 1:numSlots

for user = 1:numUsers

received_data(user, slot) = received_signal(slot);

end

end

disp('Transmitted Data:');

disp(user_data);

disp('Received Data:');

disp(received_data);

ber = sum(sum(abs(received_data - user_data))) / (numUsers *


numSlots);

fprintf('Overall Bit Error Rate (BER): %f\n', ber);

2. FDMA:
3. fs=20000;
4. fm1=1;
5. fm2=5;
6. fm3=9;
7. fcm1=25;
8. fcm2=50;
9. fcm3=75;
10. tiv=1/fs;
11. t=0:tiv:1;
12. A=2;
13. mu=0;
14. sigma=10;
15. m1=A*cos(2*pi*fm1*t);
16. sound(m1,fs);
17. pause(5);
18. len=length(m1);
19. y=lognpdf(mu,sigma);
20. m1=m1+y';
21. m2=2*A*cos(2*pi*fm2*t);
22. m3=3*A*cos(2*pi*fm3*t);
23. c1=A*cos(2*pi*fcm1*t);
24. c2=A*cos(2*pi*fcm2*t);
25. c3=A*cos(2*pi*fcm3*t);
26. x=m1.*c1+m2.*c2+m3.*c3;x=awgn(x,.02);
27. [num1,den1]=butter(5,[.5*(fcm1-fm1),fcm1+fm1]*4/fs);
28. [num2,den2]=butter(5,[.5*(fcm2-fm2),fcm2+fm2]*4/fs);
29. [num3,den3]=butter(5,[.5*(fcm3-fm3),fcm3+fm3]*4/fs);
30. filtr1=filter(num1,den1,x);
31. filtr2=filter(num2,den2,x);
32. filtr3=filter(num3,den3,x);

25
33. lp1=filtr1.c1;
34. lp2=filtr2.c2;
35. lp3=filtr3.c3;
36. [num11,den11]=butter(5,4*fm1/fs);
37. [num22,den22]=butter(5,4*fm2/fs);
38. [num33,den33]=butter(5,4*fm3/fs);
39. lpf_out1=filter(num11,den11,lp1);
40. lpf_out2=filter(num22,den22,lp2);
41. lpf_out3=filter(num33,den33,lp3);
42. figure(1);
43. subplot(3,3,1);plot(t,m1);title('Message signal 1');grid on;
44. subplot(3,3,2);plot(t,m2);title('Message signal 2');grid on;
45. subplot(3,3,3);plot(t,m3);title('Message signal 3');grid on;
46. subplot(3,3,4);plot(t,c1);title('Carrier signal 1');grid on;
47. subplot(3,3,5);plot(t,c2);title('Carrier signal 2');grid on;
48. subplot(3,3,6);plot(t,c3);title('Carrier signal 3');grid on;
49. figure(2);
50. subplot(2,2,1);
51. plot(x);
52. title('AWGN in channel');
53. subplot(2,2,2);
54. plot(lpf_out1);
55. title('Demodulated user 1');
56. subplot(2,2,3);
57. plot(lpf_out2);
58. title('Demodulated user 2');
59. subplot(2,2,4);
60. plot(lpf_out3);
61. title('Demodulated user 3');

OUTPUT:

26
62. CDMA:

Nbits=input('Enter number of bits transmitted per user:');

chipRate=input('Enter the number of chips transmitted per second:');

snr=input('Enter SNR in dB:');

user1Bits=randi([0,1],1,Nbits);

user2Bits= randi([0,1],1,Nbits);

user1Symbols=2*user1Bits-1;

user2Symbols=2*user2Bits-1;

chipSequence = [1, -1, 1, 1, -1, 1, -1, -1];

user1SpreadSymbols = kron(user1Symbols, chipSequence);

27
user2SpreadSymbols = kron(user2Symbols, chipSequence);

noiseVar = 10^(-snr/10);

user1NoisySymbols = user1SpreadSymbols + sqrt(noiseVar/2) *


randn(1, length(user1SpreadSymbols));

user2NoisySymbols = user2SpreadSymbols + sqrt(noiseVar/2) *

OUTPUT:

28
randn(1, length(user2SpreadSymbols));

user1FilteredSymbols = filter(fliplr(chipSequence),
1,user1NoisySymbols);

user2FilteredSymbols = filter(fliplr(chipSequence), 1,
user2NoisySymbols);

user1DetectedBits = user1FilteredSymbols(1:length(user1Symbols)) >


0;

user2DetectedBits = user2FilteredSymbols(1:length(user2Symbols)) >


0;

berUser1 = sum(user1DetectedBits ~= user1Bits) / Nbits;

berUser2 = sum(user2DetectedBits ~= user2Bits) / Nbits;

fprintf('Bit error rate for user 1: %f',berUser1)

fprintf('\nBit error rate for user 2: %f',berUser2)

29
RESULT:

Thus simulation of TDMA, FDMA and CDMA for wireless communication channels
were achieved through MATLAB.

30

You might also like