Wireless Comm
Wireless Comm
Wireless Comm
KEELAKUILKUDI
MADURAI-625019
BONAFIDE CERTIFICATE
Staff-In-Charge HOD
Register Number:
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:
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:
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:
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:
tx_signal = 2 * tx_symbols - 1;
Pnoise = 1 / (2 * snr);
rx_symbols = sign(equalized_signal);
ber = num_errors / N;
17
OUTPUT:
18
fprintf('Bit Error Rate (BER) with Zero Forcing Equalizer: %f\n', ber);
2. Adaptive Equalizer:
mu=0.01;
modulated_symbols = 2 * data_symbols - 1;
equalizer_length = channel_length;
for i = equalizer_length:length(received_symbols_noisy)
received_window = received_symbols_noisy(i:-1:i-
equalizer_length+1);
end
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;
transmitted_signal(slot) = transmitted_signal(slot) +
user_data(user, slot);
end
end
SNR = 10^(snr_dB/10);
23
OUTPUT:
24
for slot = 1:numSlots
end
end
disp('Transmitted Data:');
disp(user_data);
disp('Received Data:');
disp(received_data);
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:
user1Bits=randi([0,1],1,Nbits);
user2Bits= randi([0,1],1,Nbits);
user1Symbols=2*user1Bits-1;
user2Symbols=2*user2Bits-1;
27
user2SpreadSymbols = kron(user2Symbols, chipSequence);
noiseVar = 10^(-snr/10);
OUTPUT:
28
randn(1, length(user2SpreadSymbols));
user1FilteredSymbols = filter(fliplr(chipSequence),
1,user1NoisySymbols);
user2FilteredSymbols = filter(fliplr(chipSequence), 1,
user2NoisySymbols);
29
RESULT:
Thus simulation of TDMA, FDMA and CDMA for wireless communication channels
were achieved through MATLAB.
30