0% found this document useful (0 votes)
127 views

5g Communication Lab File Updated

Uploaded by

ashwanigarg667
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
127 views

5g Communication Lab File Updated

Uploaded by

ashwanigarg667
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 35

Jaipur Engineering College and Research Center, Jaipur

Lab Name: 5G communication


Lab Code:

Branch: Electronics & Communication Engineering

Year: 4thYear VII Semester

Jaipur Engineering College and Research Center, Jaipur

Department of Electronics & Communication

(Rajasthan Technical University, KOTA)


VISSION AND MISSION OF INSTITUTE

Vision:
To become a renowned centre of outcome based learning, and work towards academic, professional, cultural
and social enrichment of the lives of individuals and communities.

Mission:
• Focus on evaluation of learning outcomes and motivate students to inculcate research aptitude by
project based learning.
• Identify areas of focus and provide platform to gain knowledge and solutions based on informed
perception of Indian, regional and global needs.
• Offer opportunities for interaction between academia and industry.
• Develop human potential to its fullest extent so that intellectually capable and imaginatively
gifted leaders can emerge in a range of professions.

VISION AND MISSION OF THE DEPARTMENT


Vision:
To contribute to the society through excellence in scientific and technical education, teaching and
research aptitude in Electronics and Communication Engineering to meet the needs of Global
Industry.

MISSION OF THE DEPARTMENT


M1: To equip the students with strong foundation of basic sciences and domain knowledge of ECE,
so that they are able to creatively their knowledge to the solution of problems arising in their career
path.

M2: To induce the habit of lifelong learning to continuously enhance overall performance.

M3: Students are able to communicate their ideas clearly and concisely so that they can work in
team as well as an individual.

M4: To make the students responsive towards the ethical, social, environmental and in economic
context for the society.
PROGRAMOUTCOMES

1. Engineering Knowledge: Apply the knowledge of mathematics, science, engineering


fundamentals, and an engineering specialization to the solution of complex engineering
problems.
2. Problem analysis: Identify, formulate, research literature, and analyze complex
engineering problems reaching substantiated conclusions using first principles of
mathematics, natural sciences, and engineering sciences.
3. Design/development of solutions: Design solutions for complex engineering problems
and design system components or processes that meet the specified needs with
appropriate consideration for the public health and safety, and the cultural, societal, and
environmental considerations.
4. Conduct investigations of complex problems: Use research-based knowledge and
research methods including design of experiments, analysis and interpretation of data,and
synthesis of the information to provide valid conclusions.
5. Modern tool usage: Create, select, and apply appropriate techniques, resources, and
modern engineering and IT tools including prediction and modeling to complex
engineering activities with an understanding of the limitations.
6. The engineer and society: Apply reasoning informed by the contextual knowledge to
assesssocietal,health,safety, legaland culturalissuesandtheconsequent responsibilities
relevant to the professional engineering practice.
7. Environmentand sustainability: Understand theimpact oftheprofessional engineering
solutions in societal and environmental contexts, and demonstrate the knowledge of, and
need for sustainable development.
8. Ethics: Apply ethical principles and commit to professional ethics and responsibilities
and norms of the engineering practice.
9. Individual and team work: Function effectively as an individual, and as a member or
leader in diverse teams, and in multidisciplinary settings.
10. Communication:Communicate effectively on complex engineering activities with the
engineering community and with society at large, such as, being able to comprehend and
write effective reports and design documentation, make effective presentations, and give
and receive clear instructions.
11. Project Management and finance: Demonstrate knowledge and understanding of the
engineering and management principles and applytheseto one‟s own work, as amember
and leader in a team, to manage projects in multidisciplinary environments.
12. Life –long Learning: Recognize the need for, and have the preparation and ability to
engage in independent and life-long learning in the broadest context of technological
changes needed.
PROGRAM EDUCATIONAL OBJECTIVES

1. To strengthen students with fundamental knowledge, effective computing, problem


solving and communication skills enable them to have successful career in Information
Technology.
2. To enable students in acquiring Information Technology's latest tools, technologies and
management principles to give them an ability to solve multidisciplinary engineering
problems.
3. To impart students with ethical values and commitment towards sustainable development
in collaborative mode.
4. To reinforce students with research aptitude and innovative approaches which help them
to identify, analyse, formulate and solve real life problems and motivates them for
lifelong learning.
5. To empower students with leadership quality and team building skills that prepare them
for employment, entrepreneurship and to become competent professionals to serve
societies and global needs

Program Specific Outcomes

PSO1: Ability to develop knowledge for Robotics and it’s application.


PSO2: Ability to apply the concept of IoT for challenges of real-world.
Rajasthan Technical University Syllabus

Year/Semester: IV Year- VII Semester: B.Tech. (ECE )

Subject Code IA Marks 60


Subject 5G COMM LAB ETE 30

Number of Lecture Hours/Week 0L+0T+3P End Term Exam Hours 3 hours

1 -A History and introduction of 5G Communication Technology.


2 5G Communications Link Analysis with Ray Tracing using MATLAB
3 5G Wireless LAN Connectivity using MATLAB
4 MIMO Wireless System Design for 5G using MATLAB
5 5G Waveforms generation using MATLAB
6 5G Beam forming Design
7 Frame Structure of 5G technology
8 Implement Numerology or subcarrier spacing in 5G
9 Spatial Multiplexing and Hybrid Beam forming for 5G Wireless Communications
10. Massive MIMO System Implementation with CSI
11Implement WINNER II 5G Channel model and 3GPP
12 Evaluating the Performance of 5G Modulation and Access Schemes
13 Design and simulate 5G micro strip antenna.
Course Outcomes:

Subject: 5G Communication Lab Code:

Course Outcomes
Description

● To study and understand the concepts and design of a 5G System.


CO1

CO2  To study and Understand Mobile Radio Propagation and Various Digital
Modulation Techniques
● To Understand the Concepts Of Multiple Access Techniques And 5G Wireless
CO3
Networks
● To Understand the Concepts of implement design and simulate 5G Network.
CO$

Mapping of Course Outcomes with Program Outcomes:

High(H):3,Medium (M):2, Low(L):1

PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12
CO1 H H M H H M M M M M M M

CO2 H H M M H M M M M M M M

CO3 H H M M H M M M M M M M

CO4 H H M M H M M M M M M M

PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12
CO1 3 3 2 3 3 2 2 2 2 2 2 2

CO2 3 3 2 2 3 2 2 2 2 2 2 2

CO3 3 3 2 2 3 2 2 2 2 2 2 2

CO4 3 3 2 2 3 2 2 2 2 2 2 2
Experiment – 1
Objective: History and introduction of 5G Communication Technology.
Radio technologies have evidenced a rapid and multidirectional evolution with the launch
of the analogue cellular systems in 1980s. Thereafter, digital wireless communication
systems are consistently on a mission to fulfil the growing need of human beings (1G,
…4G, or now 5G).

The 5G technology emphasizing on its salient features, technological design


(architecture), advantages, shortcomings, challenges, and future scope.5th Generation
Mobile Network or simply 5G is the forthcoming revolution of mobile technology. The
features and its usability are much beyond the expectation of a normal human being. With
its ultra-high speed, it is potential enough to change the meaning of a cell phone usability.
With a huge array of innovative features, now your smart phone would be more parallel to
the laptop. You can use broadband internet connection; other significant features that
fascinate people are more gaming options, wider multimedia options, connectivity
everywhere, zero latency, faster response time, and high quality sound and HD video can
be transferred on other cell phone without compromising with the quality of audio and
video.

If we look back, we will find that every next decade, one generation is advancing
in the field of mobiletechnology. Starting from the First Generation (1G) in 1980s,
Second Generation (2G) in 1990s, Third Generation (3G) in 2000s, Fourth
Generation (4G) in 2010s, and now gneration (5G),
The 5G technology is expected to provide a new (much wider than the previous one)
frequency bands along with the wider spectral bandwidth per frequency channel. As of now,
the predecessors (generations) mobile technologies have evidenced substantial increase in
peak bitrate. Then — how is 5G different from the previous one (especially 4G)? The answer
is — it is not only the increase in bitrate made 5G distinct from the4G, but rather 5G is also
advanced in terms of –
 High increased peak bit rate
 Larger data volume per unit area (i.e. high system spectral efficiency)
 High capacity to allow more devices connectivity concurrently and instantaneously
 Lower battery consumption
 Better connectivity irrespective of the geographic region, in which you are
 Larger number of supporting devices
 Lower cost of infrastructural development
 Higher reliability of the communications

Architecture of 5G

Architecture of 5G is highly advanced, its network elements and various terminals are characteristically
upgraded to afford a new situation. Likewise, service providers can implement the advance technology to
adopt the value-added services easily.However, upgradeability is based upon cognitive radio technology that
includes various significant features such as ability of devices to identify their geographical location as well as
weather, temperature, etc. Cognitive radio technology acts as a transceiver (beam) that perceptively can catch
and respond radio signals in its operating environment. Further, it promptly distinguishes the changes in its
environment and hence respond accordingly to provide uninterrupted quality service.

As shown in the following image, the system model of 5G is entirely IP based model designed for the
wireless and mobile networks.
The system comprising of a main user terminal and then a number of independent and autonomous radio
access technologies. Each of the radio technologies is considered as the IP link for the outside internet world.
The IP technology is designed exclusively to ensure sufficient control data for appropriate routing of IP
packets related to a certain application connections i.e. sessions between client applications and servers
somewhere on the Internet. Moreover, to make accessible routing of packets should be fixed in accordance
with the given policies of the user
EXPERIMENT 2:

AIM: To design a model of wireless communication systems using Matlab (Two ray channeland Okumura –
Hata model)

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;

RESULT : Thus designing a model of wireless communication systems using Matlab(Two ray
channel and Okumura –Hata model) is achieved
VIVA QUESTIONS :

1. What is Okumura-Hata model in wireless communication?


2. What is the difference between Hata model and Okumura model?
3. Is the Hata model used for signal strength prediction?
4. What is wireless channel model?
5. What are the main wireless channels?
6. Which wireless channel is better?
EXPERIMENT 3:

AIM: To design a Model and simulation of Multipath fading channel

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) + 1i*randn(numPaths, numSamples));

% Generate transmitted signal

txSignal = randn(1, numSamples) + 1i*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 signalst =


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 :

RESULT:

Thus the designing of a Model and simulation of Multipath fading channel has been achieved

VIVA QUESTIONS :
1. What is multipath fading channel?
2. What are the effects of multipath fading?
3. What are multipath channels?
4. What are the causes of multipath?
5. What is the advantage of multipath?
6. How do you reduce multipath effects?
7. What are the disadvantages of multipath
EXPERIMENT 4:

AIM : 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.

CODING:

% Define simulation parameters

numBits = 1e6; % Number of bits to transmit


EbNo_dB = 10; % Eb/No in dB
% Generate QPSK symbols txSymbols =
randi([0 3], 1, numBits);
modulatedSymbols = pskmod(txSymbols, 4, pi/4);

% Add noise to the symbols


EbNo = 10^(EbNo_dB/10);
noiseVar = 1 / (2 * EbNo);
noise = sqrt(noiseVar) * 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

RESULT: Thus designing, analyzing and testing Wireless standards and evaluating the performance
measurements such as BER, PER, BLER, throughput, capacity, ACLR, EVM for 4G and 5G using Matlab has
been achieved

VIVA QUESTIONS
1. What is the ACLR measurement in Matlab?
2. What is the ACLR requirement?
3. How to generate 5G signal in MATLAB?
4. What is the use of 5G toolbox in Matlab?
5. What is the full form of ACLR?
6. How do 5G antennas work?
7. What is the use of 5G toolbox in Matlab?
EXPERIMENT 5:

AIM: To design modulation: Spread Spectrum – DSSS Modulation & Demodulation

CODING:

% DSSS Modulation and Demodulation Example

% Parameters

data = [1 0 1 0 1 1 0 0]; % Original data signal

spreadingCode = [1 1 0 1]; % Spreading code


spreadingFactor = length(spreadingCode);
% DSSS Modulation
modulatedSignal = [];
for i = 1:length(data)
chips = repmat(data(i), 1, spreadingFactor) .* spreadingCode;
modulatedSignal = [modulatedSignal chips];
end

% DSSS Demodulation

demodulatedSignal = [];

for i = 1:length(modulatedSignal)/spreadingFactor

chips = modulatedSignal((i-1)*spreadingFactor+1:i*spreadingFactor);chipSum =
sum(chips);
if chipSum>= spreadingFactor/2
demodulatedSignal = [demodulatedSignal 1];
else

demodulatedSignal = [demodulatedSignal 0];end


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

OUTPUT:
Original Data:

1 0 1 0 1 1 0 0

Demodulated Data:

1 0 1 0 1 1 0 0

RESULT: Thus designing modulation: Spread Spectrum – DSSS Modulation & Demodulation has
been achieved

VIVA QUESTIONS:

1. Why do we need spread spectrum?


2. What is spread spectrum modulation?
3. What are the types of spread spectrum?
4. What is the spread spectrum technique?
5. What is the formula for spectral spread?
6. What is the full form of DSSS?
7. What is the spreading factor of a spread spectrum?
8. What are the advantages of DSSS?
EXPERIMENT 6:

AIM: . To design a wireless Channel equalization: Zero-Forcing Equalizer (ZFE).

CODING :

% Zero-Forcing Equalizer (ZFE) MATLAB code

% Define the channel impulse responseh =


[0.1 0.3 0.4 0.2];
% Generate random transmitted symbolsN =
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 signalsnr_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 tapL =


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 algorithmerror =
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

1 1 0 1 1 0 0 1 1 1 0 1 1 0 1 0 0 1 1

Columns 20 through 38

1 1 0 1 1 1 1 1 0 1 0 1 0 0 0 0 1 1 0

Columns 39 through 57

1 0 0 0 1 1 0 0 0 1 1 1 0 1 1 0 0 0 1

Columns 58 through 76

0 1 0 1 0 1 1 1 1 1 0 0 0 1 0 1 0 1 0
Columns 77 through 95

0 0 1 0 0 1 1 1 1 0 1 1 0 1 0 0 1 1 1

Columns 96 through 100

0 1 0 0 0

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
EXPERIMENT 7:

AIM: To design a wireless Channel equalization: MMS Equalizer (MMSEE

% Parameters

M = 4; % Number of transmitted symbols

N = 1000; % Number of received symbols


SNRdB = 10; % Signal-to-Noise Ratio in dB
pilotSymbols = [1 -1 1 -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);

noiseVar = 1/(2*SNR);

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


receivedSignal = channelOutput + noise;

% Channel estimation using pilot 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
equalizerCoefficients = 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


EXPERIMENT 8:
AIM : To design a wireless Channel equalization: Adaptive Equalizer (ADE).

ADE:

% Parameters

channel_length = 10; % Length of the channel impulse responsesnr_db =


20; % Signal-to-noise ratio in dB
num_symbols = 1000; % Number of symbols to transmitmu = 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) + 1i * 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^(-snr_db / 10);
noise = sqrt(noise_power) * (randn(1, length(received_symbols)) + 1i * 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 lengthequalizer =
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

VIVA QUESTIONS :
1. What is the working principle of zero-forcing equalizer?
2. Why is zero forcing used?
3. What is the need of an equalizer?
4. What is the MMSE channel equalization?
5. What are channel equalization methods?
6. What is the function of the equalizer?
7. What is adaptive equalization of channel?
EXPERIMENT 9:

AIM: To model and simulate TDMA for wireless communication

CODING:

1.TDMA

% Step 1: Define System Parameters


numUsers = 4;
timeSlotDuration = 1; % secondstotalTimeSlots = 10;
channelGain = 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 user = 1:numUsers

if userSlots(slot) == user

% Simulate transmission for the current user in the time slot


transmittedData = userData(user, slot);
% Simulate channel effects

receivedData(user, slot) = transmittedData * channelGain;end

end
end
% 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


EXPERIMENT 10:

AIM :To model and simulate FDMA for wireless communication

% System parameters

totalBandwidth = 10e6; % Total available bandwidth (Hz)numUsers = 5; %

Number of users

carrierFrequency = 1e6; % Carrier frequency (Hz)

userBandwidth = totalBandwidth / numUsers; % Bandwidth allocated to each user (Hz)

% Time parameters

samplingFrequency = 100e6; % Sampling frequency (Hz)


timeDuration = 1e-3; % Simulation duration (s)
time = 0:1/samplingFrequency:timeDuration;

% Generate user signals

userSignals = zeros(numUsers, length(time));for i =


1:numUsers
userFrequency = carrierFrequency + (i-1) * userBandwidth; % Frequency of user signaluserSignals(i, :)
= sin(2*pi*userFrequency*time);
end
% 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 = carrierFrequency + (i-1) * userBandwidth; % Frequency of user signal
demodulatedSignals(i, :) = noisySignal .* sin(2*pi*userFrequency*time);
end

% Plot the original user signals and the demodulated signalsfigure;


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
Output:
EXPERIMENT 11:

AIM: To model and simulate BPSK Modulation for wireless communication

user1Symbols = 2 * user1Bits - 1; % Map 0s to -1 and 1s 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
user1SpreadSymbols = kron(user1Symbols, chipSequence); user2SpreadSymbols =
kron(user2Symbols, chipSequence);

% Add AWGN (Additive White Gaussian Noise)noiseVar

= 10^(-snr/10); % Noise variance

user1NoisySymbols = user1SpreadSymbols + sqrt(noiseVar/2) * randn(1,


length(user1SpreadSymbols));

user2NoisySymbols = user2SpreadSymbols + sqrt(noiseVar/2) * randn(1,


length(user2SpreadSymbols));

% Matched Filtering (correlation with chip sequence)

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


user2FilteredSymbols = filter(fliplr(chipSequence), 1, user2NoisySymbols);
% Symbol Detection (using correlation with chip sequence) user1DetectedBits =
user1FilteredSymbols(1:length(user1Symbols)) > 0;user2DetectedBits =
user2FilteredSymbols(1:length(user2Symbols)) > 0;
% Bit Error Rate (BER) Calculation

berUser1 = sum(user1DetectedBits ~= user1Bits) / 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

Viva Questions:
1. What is the basic principle of TDMA?
2. What is TDMA used for?
3. Why GSM is called TDMA?
4. What is the basic principle of FDMA?
5. What is the frequency range of FDMA?
6. What are the applications of FDMA?
7. What is the principle of CDMA?
8. What technology is used in CDMA?
9. What is the noise power of a CDMA system?

You might also like