0% found this document useful (0 votes)
11 views31 pages

Wireless Communication Record

Record

Uploaded by

lohowov347
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)
11 views31 pages

Wireless Communication Record

Record

Uploaded by

lohowov347
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/ 31

DEPARTMENT OF ELECTRONICS AND

COMMUNICATION ENGINEERING

LAB RECORD

EC3501-WIRELESS COMMUNICATION
LABORATORY

NAME :……………………………..
REGISTER NO :……………………………...
YEAR/SEM : III / V
ACADEMIC YEAR : 2024-2025
CERTIFICATE

Certified that this is a bonafide record of work done by

NAME :

REGISTER NUMBER :

SEMESTER :

BRANCH :

YEAR :

LAB-IN-CHARGE HEAD OF THE DEPARTMENT

Submitted for the Laboratory course titled “EC3501-WIRELESS

COMMUNICATION LABORATORY”.

Practical Examination held on

INTERNAL EXAMINER EXTERNAL EXAMINER


TABLE OF CONTENTS

PAGE MARKS
S.NO DATE NAME OF THE EXPERIMENTS SIGNATURE
NO. AWARDED

MODELING OF TWO RAY


1 CHANNEL AND OKUMURAHATA
MODEL

A MODEL AND SIMULATION OF


2
MULTIPAΤΗ FADING CHANNEL

DESIGN, ANALYZE AND TEST


WIRELESS STANDARDS AND
3 EVALUATE THE PERFORMANCE
MEASUREMENTS SUCH AS BER
FOR 4G & 5G USING MATLAB
DESIGN MODULATION: SPREAD
4 SPECTRUM - DSSS MODULATION
& DEMODULATION

DESIGN A WIRELESS CHANNELS


5 EQUALIZATION:ZERO - FORCING
EQUALIZER (ZFE)

DESIGN A WIRELESS CHANNEL


6 EQUALIZATION :MMS
EQUALIZER (MMSEE).

DESIGN A WIRELESS
7 CHANNELEQUALIZATION :
ADAPTIVE EQUALIZER (ADE).

MODEL AND SIMULATION OF


8 TDMA FOR WIRELESS
COMMUNICATION

MODEL AND SIMULATION OF


9 FDMA FOR WIRELESS
COMMUNICATION

MODEL AND SIMULATION OF


10 CDMA FOR
WIRELESS COMMUNICATION
CODING:
% Wireless Communication System Modeling

% Two-ray channel model and Okumura-Hata model


% System Parameters

frequency = 900e6; % Frequency in Hz


transmitterHeight = 50; % Transmitter height in meters

receiverHeight = 10; % Receiver height in meters


distance = 100:100:1000; % Distance between transmitter and receiver in meters
% Two-ray Channel Model

Pt = 1; % Transmitted power in Watts


Gt = 1; % Transmitter antenna gain

Gr = 1; % Receiver antenna gain


L = 1; % System loss

% Calculate received power using Two-ray channel model


Pr_two_ray = Pt * (Gt * Gr * (transmitterHeight * receiverHeight)^2) ./ (distance.^4 * L);

% Okumura-Hata Model
A = 69.55; % Model parameter

B = 26.16; % Model parameter


C = 13.82; % Model parameter
D = 44.9; % Model parameter

X = 6.55; % Model parameter


hb = 30; % Base station height in meters

% Calculate path loss using Okumura-Hata model


PL_okumura_hata = A + B * log10(distance) + C * log10(frequency/1e6) + D - X *
log10(hb);

% Plotting
figure;
plot(distance, Pr_two_ray, 'b-', 'LineWidth', 2);
hold on;
plot(distance, PL_okumura_hata, 'r--', 'LineWidth', 2);

xlabel('Distance (m)');
ylabel('Received Power/Path Loss (dB)');

legend('Two-ray Channel Model', 'Okumura-Hata Model');


title('Wireless Communication System Modeling');

grid on;
OUTPUT:
CODING:
% Simulation parameters

numSamples = 1000; % Number of samples


numPaths = 3; % Number of multipath paths

fadePower = 0.5; % Fading power


% Generate Rayleigh fading channel coefficients

h = sqrt(fadePower/2)*(randn(numPaths, numSamples) + li*randn(num Paths, numSamples));


% Generate transmitted signal

txSignal = randn(1, numSamples) + li randn(1, numSamples);


% Simulate multipath fading channel rxSignal zeros(1, numSamples);

for path = 1:numPaths


rxSignal = rxSignal + h(path, :) txSignal;
end

% Plot the transmitted and received signals


t= 1:numSamples;

figure;
subplot(2,1,1);

plot(t, real(txSignal), 'b', t, imag(txSignal), 'r');


title("Transmitted Signal');

legend('In-phase', 'Quadrature');
xlabel('Time');
ylabel('Amplitude');
subplot(2,1,2);
plot(t, real(rxSignal), 'b', t, imag(rxSignal), 'r');

title('Received Signal');
legend('In-phase', 'Quadrature');

xlabel('Time');
ylabel('Amplitude');
OUTPUT:
CODING:
% Define simulation parameters
numBits 1e6; % Number of bits to transmit
EbNo_dB=10; % Eb/No in dB
% Generate QPSK symbols
txSymbols = randi([03], 1, numBits);
modulatedSymbols = pskmod(txSymbols, 4, pi/4);
% Add noise to the symbols
EbNo=10^(EbNo_dB/10);
noise Var = 1/(2* EbNo); noise = sqrt(noise Var) randn(size(modulatedSymbols));
rxSymbols modulatedSymbols + noise;
% Apply Rayleigh fading channel
fadeChannel = rayleighchan (1/1000, 30);
fadedSymbols = filter(fadeChannel, rxSymbols);
% Demodulate received symbols
demodulatedSymbols = pskdemod(fadedSymbols, 4, pi/4);
% Calculate Bit Error Rate (BER)
numErrors = sum(txSymbols ~= demodulatedSymbols);
ber = numErrors/numBits;
% Display results
fprintf(‘Bit Error Rate (BER): %.4f\n’, ber);
OUTPUT:
Bit Error Rate (BER): 0.7512
CODING:
% DSSS Modulation and Demodulation Example
%Parameters
Data = [1101011001]; % Original data signal

spreadingCode [1101]; % Spreading code


spreadingFactor length(spreadingCode);

% DSSS Modulation
modulatedSignal = [];

for i = 1:length(data)
chips = repmat(data(i), 1, spreading Factor)* spreadingCode;

modulatedSignal = [modulatedSignal chips];


end

% DSSS Demodulation
demodulatedSignal = [];
for i = 1:length(modulatedSignal)/spreadingFactor

chips = modulatedSignal((i-1)*spreadingFactor+1:i*spreading Factor);


chipSum = sum(chips);

if chipSum>= spreading Factor/2


demodulatedSignal = [demodulatedSignal 1];

else
demodulatedSignal = [demodulatedSignal 0];
end
end 10

% Display Results
disp('Original Data:');
disp(data);

disp('Demodulated Data:");
disp(demodulatedSignal);
OUTPUT:
Original Data:

10101100
Demodulated Data:

10101100
CODING:
%Zero-Forcing Equalizer (ZFE) MATLAB code

% Define the channel impulse response

h = [0.1 0.3 0.4 0.2];

% Generate random transmitted symbols

N = 100;% Number of symbols

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

% Convolve transmitted symbols with the channel impulse response

received_signal conv(symbols, h);

% Add AWGN (Additive White Gaussian Noise) to the received signal

snr_dB-20; % Signal-to-Noise Ratio (SNR) in dB

received signal awgn(received_signal, snr_dB, 'measured');

% Zero-Forcing Equalizer

% Define the length of the equalizer tap

L=length(h);

% Initialize the equalizer taps

equalizer_taps = zeros(1, L);

% Loop through each received symbol and perform equalization

equalized_symbols = zeros(1, N);

for n=1:N

% Extract the received symbols for equalization

received_symbols received_signal(n:n+L-1);

% Perform zero-forcing equalization

equalized_symbols(n) = equalizer_taps * received_symbols';


% Update the equalizer taps using the least squares algorithm

error = symbols(n)-equalized_symbols(n);

equalizer_taps = equalizer_taps + error*received_symbols /(received_symbols*received_symbols');

end

% Print the original symbols and equalized symbols

disp('Original Symbols:');

disp(symbols);

disp('Equalized Symbols:');

disp(equalized_symbols);
OUTPUT:
Original Symbols:

Columns 1 through 19
1101100111011010011

Columns 20 through 38
1101111101010000110

Columns 39 through 57
1000110001110110001

Columns 58 through 76
0101011111000101010

Columns 77 through 95
0010011110110100111
Columns 96 through 100

01000
Equalized Symbols:

Columns 1 through 11
0 1.0242 1.0351 -0.0148 0.8118 0.8423 0.2395 0.3127 0.8637 0.5667 1.0034

Columns 12 through 22
0.3164 0.8987 0.7162 -0.0194 0.8262 0.2108 0.3684 1.3409 0.6328 0.5942 0.7986

Columns 23 through 33
0.3903 1.3034 0.9963 0.6816 0.6242 0.6419 0.1078 0.9584 -0.0282 0.4643 - 0.0959
Columns 34 through 44
0.3857 0.3709 0.1746 1.1529 0.6859 -0.3254 0.6316 -0.1321 0.2851 0.6131 0.9881
Columns 45 through 55

0.1328 -0.3112 0.5753 0.4748 1.4226 0.8176 0.5202 0.2300 0.9991 0.4921 - 0.2495
Columns 56 through 66

0.2145 0.5610 1.0497 -0.3251 1.0165 -0.0410 1.1669 0.3767 1.3984 0.8522 0.7683
Columns 67 through 77
0.6932 0.4118 -0.0997 0.1789 0.1747 1.2491 0.0166 1.0660 -0.0451 0.5827 - 0.1786
Columns 78 through 88
0.2406 0.4407 0.5875 -0.0514 0.5994 1.4474 0.8587 0.6711 0.4184 0.5040 1.2422

Columns 89 through 99
0.4668 -0.0972 0.6936 -0.1060 0.7651 1.3313 0.6154 0.7091 0.0191 0.5241 - 0.1900

Column 100
0.0171
CODING:
%Parameters

M = 4:% Number of transmitted symbols

N =1000; % Number of received symbols

SNRdB =10; % Signal-to-Noise Ratio in dB

pilotSymbols [1-11-1]; % Known pilot symbols

% Generate random symbols

transmittedSymbols randi([0 M-1], 1, N);

% Modulation

modulatedSymbols qammod(transmittedSymbols, M);

% Channel

channel = [0.8-0.4 0.2-0.1]; % Example channel coefficients

channelOutput filter(channel, 1, modulatedSymbols);

% Add noise

SNR=10^(SNRdB/10);

noise Var 1/(2*SNR);

noise = sqrt(noise Var) * randn(1, length(channelOutput));

receivedSignal = channelOutput + noise;

% Channel estimation using piłót symbols

pilotIndices = randperm(N, length(pilotSymbols));

pilotSignal = receivedSignal(pilotIndices);

estimatedChannel = conv(pilotSignal, conj(pilotSymbols(end:-1:1)));

estimatedChannel = estimatedChannel(end-length(channel)+1:end);

% MMSE equalization
equalizer Coefficients conj(estimated Channel) / (abs(estimated Channel).^2 + noiseVar);

equalized Symbols = filter(equalizer Coefficients, 1, receivedSignal);

% Demodulation

Demodulated Symbols qamde mod(equalizedSymbols, M);

% Calculate bit error rate

bitErrors = sum(transmitted Symbols demodulatedSymbols);

bitErrorRate = bitErrors/N;

disp([‘Bit Error Rate:’num2str(bitErrorRate)]);


OUTPUT:
Bit Error Rate: 0.787
CODING:
%Parameters

channel length 10; % Length of the channel impulse response

snr_db = 20;% Signal-to-noise ratio in dB

num_symbols = 1000; % Number of symbols to transmit

mu = 0.01;% LMS step size

% Generate random symbols

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

% Modulate symbols (e.g., BPSK modulation)

modulated_symbols = 2 * data_symbols - 1;

% Create the channel impulse response

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

% Convolve the modulated symbols with the channel

received_symbols = filter(channel, 1, modulated_symbols);

% Add noise to the received signal noise power 10^(-sar_db/10);

Noise = sqrt(noise_power)*(randn(1, length(received_symbols)) + li randn(1,

length(received symbols)));

received_symbols_noisy = received_symbols + noise;

% Adaptive equalizer using the LMS algorithm

equalizer_length=channel_length; % Set the equalizer length to match the channel length


equalizer zeros(1, equalizer_length);

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

for i = equalizer_length:length(received_symbols_noisy)

% Extract the received symbols for the current equalizer window

received_window = received_symbols_noisy(i:-1:i-equalizer_length+1);
% Compute the equalizer output

output_signal(i) = equalizer * received_window.';

% Compute the error

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

% Update the equalizer coefficients

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

end

% Demodulate the equalized symbols (decision-directed)

demodulated_symbols = real(output_signal) > 0;

% Calculate the bit error rate (BER)

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

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


OUTPUT:
Bit Error Rate (BER): 0.519
CODING:
%St 1: Define System Parameters
numUsers=4:
timeSlot Duration = 1:% seconds
total TimeSlots=10;
chamelGain = 0.8;
% Step 2: Generate User Traffic
userData randi([0, 1], numUsers, totalTimeSlots);
% Step 3: Create Time Slots
timeSlots linspace(0, timeSlotDuration totalTimeSlots, totalTimeSlots);
% Step 4: Allocate Time Slots to Users
userSlots = mod(0:totalTimeSlots-1, numUsers) + 1;
% Step 5: Simulate Transmission
receivedData = zeros(numUsers, totalTimeSlots);
for slot 1:totalTimeSlots
for user1:numUsers
if user Slots(slot) - user
% Simulate transmission for the current user in the time slot
transmittedData = userData(user, slot);
% Simulate channel effects
receivedData(user, slot) = transmitted Data * channelGain;
end
end
end 19
% Step 6: Evaluate Performance Metrics (e.g., BER)
bitErrorRate = sum(sum(xor(receivedData, userData))) / (numUsers * totalTimeSlots);
% Step 7: Visualize Results
figure;
subplot(2, 1, 1);
stem(timeSlots, userData');
title('User Traffic');
xlabel('Time (s)');
ylabel('Data');
legend('User 1', 'User 2', 'User 3', 'User 4');
subplot(2, 1, 2);
stem(timeSlots, receivedData');
title('Received Data');
xlabel('Time (s)');
ylabel('Data');
legend('User 1', 'User 2', 'User 3', 'User 4');
disp(['Bit Error Rate: ', num2str(bitErrorRate)]);
OUTPUT:
Bit Error Rate: 0.375
CODING:
% System parameters
total Bandwidth = 10 c6. % Total available bandwidth (Hz)
numUsers 5: % Number of users
carrier Frequency 106; % Carrier frequency (Hz)
userBandwidth totalBandwidth/numUsers; % Bandwidth allocated to each user (Hz)
% Time parameters
sampling Frequency = 100 e6; % Sampling frequency (Hz)
timeDuration% Simulation duration (s) = 1e - 3 time 0:1/sampling Frequency:timeDuration;
% Generate user signals userSignals = zeros(numUsers, length(time));
for i = 1 numUsers
user Frequency = carrier Frequency + (i-1)* userBandwidth; % Frequency of user signal
userSignals(i,:)sin(2*pi*userFrequency time);
end 21
% Create the FDMA signal
fdmaSignal = sum(userSignals, 1);
% Add noise to the FDMA signal
snr = 10 ; % Signal-to-Noise Ratio (in dB)
noisySignal awgn(fdmaSignal, snr, 'measured');
% Perform signal demodulation
demodulatedSignals = zeros(numUsers, length(time));
for i = 1 numUsers
userFrequency = carrier Frequency + (i-1)* userBandwidth; % Frequency of user signal
demodulatedSignals(i, :) = noisy Signal.* sin(2*pi* userFrequency time);
end
% Plot the original user signals and the demodulated signals
figure;
subplot(numUsers+1, 1, 1);
plot(time, fdmaSignal);
title('FDMA Signal');
xlabel('Time (s)');
ylabel('Amplitude');
for i=1:numUsers
subplot(numUsers+1, 1, i+1);
plot(time, demodulatedSignals(i, :));
title(['Demodulated Signal - User', num2str(i)]);
xlabel('Time (s)');
ylabel('Amplitude');
end 22
OUTPUT:
CODING:
% CDMA Simulation Parameters
numBits 1000; % Number of bits per user
chipRate = 1c6i % Chip rate (chips per second)
snr= 10 , % Signal-to-Noise Ratio (dB)
% Generate random data bits for User 1 and User 2
user1 Bits randi([0, 1], 1, numBits);
user2Bits randi([0, 1], 1, numBits);
% BPSK Modulation
user1Symbols=2*user1Bits - 1; % Map Os to -1 and is to 1
user2Symbols = 2*user2Bits - 1;
% Chip-level Spreading (using a simple chip sequence)
chipSequence [1, -1, 1, 1, -1, 1, -1, -1]; % Chip sequence for spreading
user1 SpreadSymbols = kron(user1 Symbols, chipSequence);
user2SpreadSymbols = kron(user2Symbols, chipSequence); 23
% Add AWGN (Additive White Gaussian Noise)
noise Var = 10 ^ (- s * nr / 10) ; % Noise variance
user1 Noisy Symbols-userl SpreadSymbols + sqrt(noiseVar/2)* randn(1,
length(user1SpreadSymbols));
user2NoisySymbols = user2SpreadSymbols + sqrt(noise Var/2)* randn(1,
length(user2SpreadSymbols));
% Matched Filtering (correlation with chip sequence)
user1FilteredSymbols=filter(fliplr(chipSequence), 1, user1 Noisy Symbols);
user2FilteredSymbols = filter(fliplr(chipSequence), 1, user2NoisySymbols);
% Symbol Detection (using correlation with chip sequence)
user1DetectedBits=user1FilteredSymbols(1:length(userl Symbols)) > 0 ;
user2DetectedBits=user2FilteredSymbols(1:length(user2Symbols)) > 0 ;
% Bit Error Rate (BER) Calculation
berUser1 sum(user) DetectedBits userl Bits)/numBits;
berUser2 = sum(user2DetectedBits user2Bits) / numBits;
% Display results
disp(['User 1 BER: ', num2str(berUser1)]);
disp(['User 2 BER: ', num2str(berUser2)]);
OUTPUT:
User 1 BER: 0.523

User 2 BER: 0.535

You might also like