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

CEC331 CN LAB

The document outlines the laboratory record for a 4G/5G Communication Networks course, detailing experiments conducted using MATLAB for 5G waveform generation, synchronization signal modeling, and channel modeling. It includes a list of experiments, procedures, and coding examples for each experiment, along with theoretical background and expected results. The laboratory work is certified for the academic year 2023-24 for students in their third year, fifth semester of Electronics and Communication Engineering.

Uploaded by

ARI
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

CEC331 CN LAB

The document outlines the laboratory record for a 4G/5G Communication Networks course, detailing experiments conducted using MATLAB for 5G waveform generation, synchronization signal modeling, and channel modeling. It includes a list of experiments, procedures, and coding examples for each experiment, along with theoretical background and expected results. The laboratory work is certified for the academic year 2023-24 for students in their third year, fifth semester of Electronics and Communication Engineering.

Uploaded by

ARI
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 54

DEPARTMENT OF ELECTRONICS & COMMUNICATION

ENGINEERING

CEC331 - 4G/5G COMMUNICATION


NETWORKS LABORATORY
[Regulation - 2021]

Laboratory Record

Name :

Reg. No. :

Academic Year : 2023-24

Year/semester : III Year / V Semester


DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING

LABORATORY RECORD

Name……………………………………………………………………………….

Register No………………………………Semester……………………………….

Branch………………………………………………………………………………

Certified that this is bonafide record of Work done by the above student
of the………………………………………………………………………………..

Laboratory during the year 2023-24

FACULTY IN-CHARGE
HEAD OF THE DEPARTMENT

Submitted for the Practical Examination held on………………………………….

INTERNAL EXAMINER EXTERNAL EXAMINER


LIST OF EXPERIMENTS
SIMULATION USING MATLAB

1. 5G-Compliant waveform generation and testing

2. Modeling of 5G Synchronization signal blocks and bursts

3. Channel modeling in 5G networks

4. Multiband OFDM demodulation

5. Perfect Channel estimation

6. Development of 5g New Radio Polar Coding

CONTENT BEYOND SYLLABUS:

1. OFDM, QAM, PSK waveform Configuration, Constellation diagram Using MATLAB 2023a APP.

TOTAL: 30 PERIODS
INDEX
Staff
S.No Date Name of the experiment Mark
Signature

5G-Compliant waveform generation


1.
and testing

Modeling of 5G Synchronization
2.
signal blocks and bursts

3. Channel modeling in 5G networks

4. Multiband OFDM demodulation

5. Perfect Channel estimation

Development of 5g New Radio Polar


6.
Coding

5G Complaint waveform for OFDM,


7.
QAM and PSK
CODING: %GENERATION OF 5G COMPLIANT SIGNAL
%Define the parameters

fc = 28e9; %carrier frequency


fs = 30e9; %sampling frequency
N = 1024; %number of samples
%Generate the signal
t = 0:1/fs:N/fs-1/fs; %time vector
x = cos(2*pi*fc*t); %signal
%Plot the signal
figure;
plot(t,x);
title('5G Compliant Signal');
xlabel('Time (s)');
ylabel('Amplitude');
%Testing of 5G compliant signal

%Define the parameters


fc_test = 28e9; %carrier frequency
fs_test = 30e9; %sampling frequency
N_test = 1024; %number of samples
%Generate the signal
t_test = 0:1/fs_test:N_test/fs_test-1/fs_test; %time vector
x_test = cos(2*pi*fc_test*t_test); %signal
%Calculate the power spectral density
[Pxx,f] = periodogram(x_test,[],N_test,fs_test);
%Plot the power spectral density
figure;
plot(f,Pxx);

title('Power Spectral Density of 5G Compliant Signal');


xlabel('Frequency (Hz)');
ylabel('Power Spectral Density (dB/Hz)');
EXP NO: 1 5G-COMPLIANT WAVEFORM GENERATION AND TESTING
Date:

AIM:
Develop a MATLAB program to model 5G Synchronization Signal Blocks (SSBs) and
Bursts.

APPARATUS REQUIRED:
 Hardware: Personal computer
 Software : MATLAB , 5G Toolbox, knowledge of 5G NR standard.

PROCEDURE:
1. Start the MATLAB 2023a
2. Open M file
3. Type the program
4. Save in the current Directory
5. Compile and Run the Program

6. If any error occurs in the program correct and run it again


7. For the output see current window/ Figure window
8. Stop the Program.

THEORY:
1. Waveform Design: The first step in the generation of a 5G compliant waveform is to
design the waveform. This involves selecting the modulation type, the number of
subcarriers, the number of symbols, and the symbol rate.
2. Channel Estimation: The next step is to estimate the channel characteristics. This is done
by measuring the signal strength and the noise level at the receiver.
3. Equalization: Once the channel characteristics are known, the signal can be equalized to
reduce the effects of noise and interference. This is done by applying a filter to the
signal.
4. Modulation: The signal is then modulated using the chosen modulation type. This
involves mapping the data onto the signal in a way that is compatible with the 5G
standard.
5. Waveform Generation: Finally, the waveform is generated by combining the modulated
signal with the equalized signal.
Output:
RESULT:
CODING:

% Set simulation parameters


numSsb = 4; % Number of SSBs in a
burst ssbLength = 127; % Length of each
SSB numBursts = 10; % Number of bursts
snr = 20; % Signal-to-noise ratio in dB
% Generate random SSBs
ssbs = randi([0, 1], numSsb * ssbLength * numBursts, 1);
% Transmit SSBs (simulated channel with
noise) receivedSSBs = awgn(ssbs, snr,
'measured');
% Extract SSBs from received signal
extractedSSBs = reshape(receivedSSBs, ssbLength, numSsb * numBursts);
% Perform processing on each SSB
for i = 1:numSsb * numBursts
% Process each SSB here (e.g., synchronization and decoding)
% This is a placeholder for actual
processing end
% Display results (for
illustration) disp('SSB Processing
Results:'); for i = 1:numSsb *
numBursts
disp(['SSB ' num2str(i) '
processed']); end
EXP NO: 2 MODELING 5G SYNCHRONIZATION SIGNAL BLOCKS
(SSBS) AND BURSTS
Date:

AIM:

Develop a MATLAB program to model 5G Synchronization Signal Blocks (SSBs) and


Bursts.
APPARATUSREQUIRED:
 Hardware: Personal computer
 Software :MATLAB , 5GToolbox,knowledge of 5G NR standard.

PROCEDURE:
1. Start the MATLAB 2023a
2. Open M file
3. Type the program
4. Save in the current Directory
5. Compile and Run the Program
6. If any error occurs in the program correct and run it again
7. For the output see current window/ Figure window
8. Stop the Program.

THEORY:
In the 5G NR downlink frame, SS blocks are transmitted towards UEs at regular
intervals based on periodicity set (i.e. 5/10/20/40/80/160 ms). Multiple SS blocks are carried
in a SS burst. A single SS block spans 4 OFDM symbols on time axis and 240 subcarriers on
frequency axis. SS block carry PSS (Primary Synchronization Signal), SSS (Secondary
Synchronization Signal) and PBCH with DMRS. The SS blocks are grouped into first 5 ms of
the SS burst. The maximum number (L) of SS blocks in single burst is frequency dependant.
There can be about 64 blocks per burst at frequencies above 6 GHz (i.e.mmwave frequencies).
Following are the possible candidate SSB locations (L) within SS Burst set.

• L =4 for Up to 3 GHz

• L = 8 from 3 GHz to 6 GHz

• L = 64 from 6 GHz to 52.6 GHz


OUTPUT:
Here DMRS (Demodulation Reference Signal) associated with PBCH channel is used
to estimate RSRP (Reference signal received power) is calculated from the received SS blocks
at the UE.

In 5G NR system SS blocks are transmitted using directional beams unlike LTE. In


LTE, downlink frame is transmitted omnidirectionally which carries PSS and SSS signals. UE
is aware of their location in control channel.

SS block contains are as follows.

• 1 Symbol PSS

• 1 Symbol SSS

• 2 Symbols PBCH
• Each SS Bursts carry one or multiple SS blocks.

• SS Burst set consists of one or multiple SS bursts.

• Transmission is periodic (20 ms by default).

• The transmission of SSBs within SS burst set is confined within a 5 ms window.


In 5G NR, SSBs are used for cell search and initial synchronization. SSBs are
transmitted within SSB bursts, and they carry specific synchronization signals. Modeling
SSBs and Bursts involves generating and processing these signals.
RESULT:
CODING:

% 5G Channel Modeling
% Set simulation parameters
numSamples = 1000; % Number of samples
numTxAnts = 2; % Number of transmit
antennas numRxAnts = 2; % Number of receive
antennas
carrierFreq = 3.5e9; % Carrier frequency in Hz (3.5 GHz)
sampRate = 15.36e6; % Sampling rate in Hz (15.36
MHz)
% Create a 5G NR channel configuration
channel = nrTDLChannel;
channel.NumTransmitAntennas = numTxAnts;
channel.NumReceiveAntennas = numRxAnts;
channel.DelayProfile = 'CDL-D';
channel.DelaySpread = 30e-9;
channel.CarrierFrequency = carrierFreq;
channel.SampleRate = sampRate;
channel.NormalizePathGains = true;
% Generate random QPSK symbols
data = randi([0, 3], numSamples, numTxAnts);
% Modulate the symbols using QPSK modulation
modulatedData = qammod(data, 4, 'UnitAveragePower',
true);
% Pass the modulated signal through the
channel channelOutput =
channel(modulatedData);
% Calculate the received signal power per receive antenna
rxPowerPerAntenna = sum(abs(channelOutput).^2) / numSamples;
% Display received power for each
antenna disp('Received Power per
Antenna:'); disp(rxPowerPerAntenna);
% Plot the channel impulse response for the first receive antenna
figure; plot(0:numSamples-1, abs(channelOutput(:, 1)));
title('Channel Impulse Response (First Receive Antenna)');
xlabel('Sample Index');
ylabel('Magnitude');
% Plot the frequency response for the first receive antenna figure;
EXP No.:3 CHANNEL MODELLING IN 5G NETWORKS
Date:

AIM:
Develop a MATLAB program for channel modeling in 5G Networks.

APPARATUS REQUIRED:
 Hardware: Personal computer
 Software : MATLAB, 5GToolbox, knowledge of 5G NR standard.

PROCEDURE:
1. Start the MATLAB 2023a
2. Open M file
3. Type the program
4. Save in the current Directory
5. Compile and Run the Program
6. If any error occurs in the program correct and run it again
7. For the output see current window/ Figure window
8. Stop the Program.

THEORY:
In 5G Networks, channel modeling involves simulating wireless communication
channel between a transmitter and receiver. This simulation accounts for various factors such
as path loss, fading, delay spread, and channel characteristics at different frequency bands
and scenarios(e.g.,urban,rural,indoor).

A channel model is a mathematical representation of the effects of a communication


channel through which wireless signals are propagated. The channel model can represent the
power loss incurred by the signal as it travels through the wireless medium. In a more general
case, the channel model is the impulse response of the channel medium in the time domain or
its Fourier transform in the frequency domain. The channel impulse response of a wireless
communication system typically varies randomly over time.
freqz(channelOutput(:, 1));
title('Channel Frequency Response (First Receive Antenna)');
Channel Modelling in 5G
Furthermore, 5G systems should be adapted to a wide range of scenarios, such as indoor,
urban, suburban, rural area, etc. All the above-mentioned technologies set new requirements
for 5G channel modeling, which are summarized as follows:
1) Wide Frequency Range: A new 5G channel model should support a wide frequency
range, e.g., 350 MHz to 100 GHz. The model at higher frequency bands, e.g., above 6 GHz,
should maintain compatibility with the model at lower frequency bands, e.g., below 6 GHz.
2) Broad Bandwidths: A new 5G channel model should have the ability to support large
channel bandwidths, e.g., 500 MHz to 4 GHz.
3) Wide Range of Scenarios: A new 5G channel model should be able to support a wide
range of scenarios such as indoor, urban, suburban, rural area, high-speed train (HST)
scenarios, etc.
4) Double-Directional Three-Dimensional (3D) Modeling: A new 5G channel model
should provide full 3D modeling, including accurate 3D antenna modeling and 3D
propagation modeling.
5) Smooth Time Evolution: A new 5G channel model has to evolve smoothly over time,
involving parameters drifting and cluster fading in and fading out, which are important to
support mobility and beam tracking for 5G communications.
6) Spatial Consistency: Spatial consistency means two closely located transmitters or
receivers should have similar channel characteristics. Channel states including large scale
parameters (LSPs), small-scale parameters (SSPs), line-of-sight/non line-of-sight
(LoS/NLoS) condition, and indoor/outdoor state should vary in a continuous and realistic
manner as a function of position.
7) Frequency Dependency and Frequency Consistency: The parameters and statistics of a
new 5G channel model should vary smoothly with the frequency. Channel parameters and
statistics at adjacent frequencies should have strong correlations.
8) Massive MIMO: A new 5G channel model must support massive MIMO, i.e., spherical
wavefront and array non-stationarity have to be properly modeled.
— Spherical wavefront: In massive MIMO systems, the distance between the
transceiver and cluster could be less than the Rayleigh distance. Therefore, spherical
wavefront instead of plane wavefront must be considered.
— Array non- stationarity: Array non-stationarity refers to the fact that clusters may
appear or disappear from the viewpoint of one antenna element to the next one, which
means different antenna elements could see different cluster sets. It also means
parameters, such as power and delay drift, over different antenna elements.
9) Direct D2D/V2V: In D2D/V2V scenarios, both the transmitter and receiver are equipped
with lower antennas and may interact with a large number of scatterers. D2D/V2V channel
models have to take into account the mobility of both ends, which significantly increases the
modeling complexity. The relative speed between the two ends and fast-changing
environments introduce extra Doppler frequency shift and result in serious non-stationary
channels. All of these make the D2D/V2V channels differ greatly from conventional cellular
channels.
OUTPUT:

Channel modelling
Received Power per
Antenna: 1.3151 1.1736
10) High Mobility: A new 5G channel model should support high mobility scenarios, such
as HST scenario with the speed of the train even over 500 km/h. The model should be able to
capture certain characteristics of high mobility channels, such as large Doppler frequency
and non-stationarity. Furthermore, the channel model has to work reliably in various HST
scenarios, including open space, viaduct, cutting, hilly terrain, tunnel, station scenarios, etc

RESULT:
CODING:

% Set simulation parameters


numSubcarriers = 64; % Number of subcarriers
numSymbols = 10; % Number of OFDM
symbols numGuard = 6; % Number of guard
subcarriers cpLength = 16; % Cyclic prefix
length channelDelay = 3; % Channel delay in
samples snrdB = 20; % Signal-to-noise ratio in
dB
% Generate BPSK symbols
txData = randi([0, 1], numSubcarriers * numSymbols,
1); modulatedData = 2 * txData - 1;
% Reshape modulated data into subcarriers
dataMatrix = reshape(modulatedData, numSubcarriers, numSymbols);
% Perform IFFT on each subcarrier
timeDomainData = ifft(dataMatrix,
numSubcarriers);
% Add cyclic prefix
cyclicPrefix = timeDomainData(end - cpLength + 1:end, :);
timeDomainDataWithCP = [cyclicPrefix; timeDomainData];
% Transmit the time-domain signal through a channel (simulated with delay and noise)
channelOutput = [zeros(channelDelay, numSymbols); timeDomainDataWithCP];
rxSignal = channelOutput + (randn(size(channelOutput)) + 1i *
randn(size(channelOutput))) / sqrt(2) * 10^(-snrdB / 20);
% Remove cyclic prefix
rxSignalNoCP = rxSignal(cpLength + 1:end, :);
% Perform FFT on each subcarrier
freqDomainData = fft(rxSignalNoCP, numSubcarriers);
% Demodulate BPSK symbols
demodulatedData = real(freqDomainData(:)) > 0; % BPSK demodulation
% Calculate bit error rate (BER)
ber = sum(txData ~= demodulatedData) / (numSubcarriers * numSymbols);
% Display results
disp(['Bit Error Rate (BER): ' num2str(ber)]);
disp(['Number of Errors: ' num2str(sum(txData ~= demodulatedData))]);
EXP No. 4 : MULTIBAND OFDM DEMODULATION

Date:

AIM:
Develop a MATLAB program for Multiband OFDM (MB-OFDM) demodulation.

APPARATUSREQUIRED:
 Hardware: Personal computer
 Software : MATLAB, 5GToolbox, knowledge of 5G NR standard.
PROCEDURE:
1. Start the MATLAB 2023a
2. Open M file
3. Type the program
4. Save in the current Directory
5. Compile and Run the Program
6. If any error occurs in the program correct and run it again
7. For the output see current window/ Figure window
8. Stop the Program.

THEORY:

Single-band radio that occupies the whole allocated spectrum in favor of Multi-band
design approach Multi-banding consists in dividing the available spectrum into several sub-
bands. By interleaving symbols across different sub-bands, UWB system can still maintain the
same transmit power as if it was using the entire bandwidth.

The main difference between the multi-band OFDM system and other narrowband OFDM
systems is the way that different sub-bands are used in the system. The transmission is not
done continually on all sub-bands. Rather, it is time multiplexed between different bands in
order to use a single hardware for communications over different sub-bands.

OFDM system except that the carrier frequency changes from symbol to symbol
according to a sub-band hopping scheme. The convolutional code with interleaving is used to
combat multipath fading. The main idea of the MB-OFDM is that the high rate serial data
stream is converted into the N parallel low rate data stream in order to combat the frequency
OUTPUT:

OFDM Demodulation
Bit Error Rate (BER): 0.50156
Number of Errors: 321
selective fading prevent inter-carrier-interference (ICI) while avoiding adopting the complex
MIMO-EQ at the receiver.

The OFDM modulation is performed by an inverse fast Fourier transform (IFFT) and a
cyclic prefix (CP) is added to cancel inter-block interference (IBI) and inert-channel
interference (ICI). A guard interval of silence is also added to allow the transmitter and
receiver to switch from one sub-band to another. The signal is then is fed into a D/A converter
and sent to the RF section. At the receiver the signal is sampled after down conversion and
filtering. Demodulation is performed using a fast Fourier transform (FFT) followed by one-tap
frequency domain equalization and decision

MB-OFDM demodulation involves several key steps, including synchronization, symbol


extraction, and decoding. In this example, we will focus on the basic steps involved in
demodulating MB-OFDM signals.

Multi-Band Orthogonal Frequency Division Multiplexing (MB-OFDM) is a variation of


OFDM that divides the available spectrum into multiple subbands. Each subband is treated as
a separate OFDM system, and the data is transmitted simultaneously over all subbands.
Demodulating MB-OFDM signals typically involves processing each subband separately.

In this code:
1. We generate random QPSK symbols for each subband and add AWGN
to simulate noisy transmission.
2. Demodulation of each subband is performed using the
demodulate_OFDM function. You should replace this function with your specific
demodulation implementation, which typically involves steps like removing the
cyclic prefix, performing FFT, and decoding.
3. The demodulated bits are stored in the rx_bits cell array, where each
element corresponds to a subband.
4. You can further process and combine the demodulated bits from
different subbands based on your system requirements
RESULT:
CODING:

% Set simulation parameters


numSubcarriers = 64; % Number of subcarriers
numSymbols = 10; % Number of OFDM
symbols cpLength = 16; % Cyclic prefix length
snrdB = 20; % Signal-to-noise ratio in dB
% Generate BPSK symbols
txData = randi([0, 1], numSubcarriers * numSymbols, 1);
modulatedData = 2 * txData - 1;
% Reshape modulated data into subcarriers
dataMatrix = reshape(modulatedData, numSubcarriers, numSymbols);
% Perform IFFT on each subcarrier
timeDomainData = ifft(dataMatrix,
numSubcarriers);
% Add cyclic prefix
cyclicPrefix = timeDomainData(end - cpLength + 1:end, :);
timeDomainDataWithCP = [cyclicPrefix; timeDomainData];
% Transmit the time-domain signal through a channel (simulated with delay and noise)
rxSignal = timeDomainDataWithCP + (randn(size(timeDomainDataWithCP)) + 1i *
randn(size(timeDomainDataWithCP))) / sqrt(2) * 10^(-snrdB / 20);
% Remove cyclic prefix
rxSignalNoCP = rxSignal(cpLength + 1:end, :);
% Perform FFT on each subcarrier
freqDomainData = fft(rxSignalNoCP, numSubcarriers);
% Estimate the channel using known pilot symbols (e.g., in 5G Synchronization Signals)
pilotIndexes = [7, 21, 43, 57];
pilotSymbols = freqDomainData(pilotIndexes, :);
% Perform channel estimation (simplified: assume known pilot symbols and linear
interpolation)
channelEstimates = interp1(pilotIndexes, pilotSymbols, 1:numSubcarriers, 'linear',
'extrap');
EXP No. 5: PERFECT CHANNEL ESTIMATION EXAMPLE FOR OFDM
(BPSK MODULATION)
Date:

AIM:
To develop a MATLAB program for perfect channel estimation in an OFDM using BPSK
modulation.

APPARATUSREQUIRED:
 Hardware: Personal computer
 Software :MATLAB , 5GToolbox, knowledge of 5G NR standard.
PROCEDURE:
1. Start the MATLAB 2023a
2. Open M file
3. Type the program
4. Save in the current Directory
5. Compile and Run the Program
6. If any error occurs in the program correct and run it again
7. For the output see current window/ Figure window
8. Stop the Program.

THEORY:
Channel estimation is an important technique especially in mobile wireless network systems
where the wireless channel changes over time, usually caused by transmitter and/or receiver
being in motion at vehicular speed.

Mobile wireless communication is adversely affected by the multipath interference resulting


from reflections from surroundings, such as hills, buildings and other obstacles.

In order to provide reliability and high data rates at the receiver, the system needs an
accurate estimate of the time-varying channel.

Furthermore, mobile wireless systems are one of the main technologies which used to
provide services such as data communication, voice, and video with quality of service (QoS)
for both mobile users and nomadic.
% Demodulate BPSK symbols using channel estimates
estimatedSymbols = real(channelEstimates) > 0; % BPSK demodulation
% Calculate bit error rate (BER)
ber = sum(txData ~= estimatedSymbols(:)) / (numSubcarriers * numSymbols);
% Display results
disp(['Bit Error Rate (BER): ' num2str(ber)]);
disp(['Number of Errors: ' num2str(sum(txData ~= estimatedSymbols(:)))]);
The knowledge of the impulse response of mobile wireless propagation channels in the
estimator is an aid in acquiring important information for testing, designing or planning
wireless communication systems.

Channel estimation is based on the training sequence of bits and which is unique for a
certain transmitter and which is repeated in every transmitted burst .The channel estimator
gives the knowledge on the channel impulse response (CIR) to the detector and it
estimates separately the CIR for each burst by exploiting transmitted bits and
corresponding received bits. Signal detectors must have knowledge concerning the
channel impulse response (CIR) of the radio link with known transmitted sequences,
which can be done by a separate channel estimator.

The modulated corrupted signal from the channel has to be undergoing the channel
estimation using LMS, MLSE, MMSE, RMS etc before the demodulation takes place at
the receiver side.

In an OFDM system, perfect channel estimation involves accurately estimating the


frequency response of the channel at each subcarrier. This estimation is essential for
equalization and demodulation at the receiver. Typically, pilot symbols are inserted into
the transmitted signal, and these known symbols are used for channel estimation.

1. Parameters like the SNR (Signal-to-Noise Ratio), number of symbols, symbol rate,
modulation order, and Eb/No (Energy per bit to Noise power spectral density ratio) are
defined.

2. Random binary data is generated for transmission.

3. The data is modulated using BPSK modulation (pskmod function).

4. A perfect channel represented by H is assumed, where H is a complex fading gain


with a magnitude of 1 and a random phase.

5. Complex Gaussian noise is added to the received signal to simulate the effect of noise.

6. The received signal is demodulated using BPSK demodulation (pskdemod function).

7. The bit error rate (BER) is calculated by comparing the transmitted and received data
bits.
OUTPUT:
Channel estimation
Bit Error Rate (BER): 0.48594
Number of Errors: 311
RESULT:
CODING:
POLAR CODE ENCODING:

s = rng(100); % Seed the RNG for repeatability


%Specify the code parameters used for a simulation.
% Code parameters
K = 54; % Message length in bits, including CRC, K >
30 E = 124; % Rate matched output length, E <= 8192
EbNo = 0.8; % EbNo in dB
L = 8; % List length, a power of two, [1 2 4
8] numFrames = 10; % Number of frames to simulate
linkDir = 'DL'; % Link direction: downlink ('DL') OR uplink
('UL') if strcmpi(linkDir,'DL')
% Downlink scenario (K >= 36, including CRC bits)
crcLen = 24; % Number of CRC bits for DL, Section 5.1,
[6] poly = '24C'; % CRC polynomial
nPC = 0; % Number of parity check bits, Section 5.3.1.2, [6]
nMax = 9; % Maximum value of n, for 2^n, Section 7.3.3, [6]
iIL = true; % Interleave input, Section 5.3.1.1, [6]
iBIL = false; % Interleave coded bits, Section 5.4.1.3, [6]
else
% Uplink scenario (K > 30, including CRC
bits) crcLen = 11;
poly = '11';
nPC = 0;
nMax = 10;
iIL = false;
iBIL = true;
end
%Polar Encoding
R = K/E; % Effective code rate
bps = 2; % bits per symbol, 1 for BPSK, 2 for
QPSK EsNo = EbNo + 10*log10(bps);
snrdB = EsNo + 10*log10(R); % in
dB noiseVar = 1./(10.^(snrdB/10));
EXP No. 6: DEVELOPMENT OF 5G NEW RADIO POLAR CODING &
DECODING
Date:

AIM:
Develop a MATLAB program for 5G NR Polar Coding and Decoding.
APPARATUSREQUIRED:

 Hardware: Personal computer


 Software: MATLAB software, 5GTool box, knowledge of polar codes and the
5G NR standard.
PROCEDURE:
1. Start the MATLAB 2023a
2. Open M file
3. Type the program
4. Save in the current Directory
5. Compile and Run the Program
6. If any error occurs in the program correct and run it again
7. For the output see current window/ Figure
window Stop the Program
THEORY:
Polar codes are error-correcting codes used in the control channels of the 5G NR
standard. Polar coding involves two main processes: encoding and decoding.

Define your Polar codes: Define the length of your codeword, code rate, and the
construction type for Polar codes. In 5G NR, various code lengths and rates are used for
different control and data channels. You can use the MATLAB Communications System
Toolbox for encoding and decoding Polar codes.

Polar Encoder: Use the comm.PolarEncoder object in MATLAB to create a Polar


encoder for your specified parameters. Here's an example of how you can create a Polar
encoder:

encode your message: Generate your message bits and encode them using the Polar
encoder you created.

Polar Decoder: Create a Polar decoder to decode the received bits. You can use the
comm.PolarDecoder object in MATLAB:
% Channel
chan = comm.AWGNChannel('NoiseMethod','Variance','Variance',noiseVar);
%polor decoding
% Error meter
ber = comm.ErrorRate;
numferr = 0;
for i = 1:numFrames

% Generate a random message


msg = randi([0 1],K-crcLen,1);

% Attach CRC
msgcrc = nrCRCEncode(msg,poly);

% Polar encode
encOut =
nrPolarEncode(msgcrc,E,nMax,iIL); N =
length(encOut);

% Rate match
modIn = nrRateMatchPolar(encOut,K,E,iBIL);

% Modulate
modOut = nrSymbolModulate(modIn,'QPSK');

% Add White Gaussian noise


rSig = chan(modOut);
% Soft demodulate
rxLLR = nrSymbolDemodulate(rSig,'QPSK',noiseVar);

% Rate recover
decIn = nrRateRecoverPolar(rxLLR,K,N,iBIL);

% Polar decode
decBits = nrPolarDecode(decIn,K,E,L,nMax,iIL,crcLen);
% Compare msg and decoded bits
Simulate the Channel: Simulate the transmission through a binary symmetric channel (BSC)
or any other channel model you prefer. The channel introduces errors into the received bits.

Decode the received bits: Decode the received bits using the Polar decoder:

Evaluate the Performance: Calculate the bit error rate (BER) or any other performance metrics
to assess the effectiveness of your Polar coding implementation.

The selection of polar codes as the channel coding technique for control channels for 5G
NR communications systems. Based on the concept of channel polarization, this new coding
family is capacity achieving as opposed to just capacity approaching. With better or
comparable performance than LDPC and turbo codes, it supersedes the tail-biting
convolutional codes used in LTE systems for control channels. It is applied for downlink and
uplink control information (DCI/UCI) for the enhanced mobile broadband (eMBB) use case,
as well as the broadcast channel (BCH). Alternatively, the channel coding scheme for data
channels for eMBBis specified to be flexible LDPC for all block sizes.

3GPP has selected polar codes as the error correcting code on the 5G NR control channels.
Polar codes are unique in the way they split the channel into good and bad bit-channels.

Consider a polar code where K information bits are being sent in a block of N bits. Polar
code encoding will polarize the channel into reliable and unreliable bit-channels. The
information bits will be transmitted on the most reliable K bit-channels. The remaining N-
K channels are unreliable are usually set to 0 as they are not reliable for data transmission.
errStats = ber(double(decBits(1:K-crcLen)), msg);
numferr = numferr + any(decBits(1:K-crcLen)~=msg);
end
disp(['Block Error Rate: ' num2str(numferr/numFrames) ...
', Bit Error Rate: ' num2str(errStats(1)) ...
', at SNR = ' num2str(snrdB) '

dB']) rng(s); % Restore RNG

OUTPUT:
>> polarcoding1
Block Error Rate: 0, Bit Error Rate: 0, at SNR = 0.20002 dB
RESULT:
OFDM WAVEFORM.

%% Generating OFDM waveform


% OFDM configuration
ofdmMod = comm.OFDMModulator(‘FFTLength’, 64, …
‘NumGuardBandCarriers’, [6;5], …
‘InsertDCNull’, false, …
‘CyclicPrefixLength’, 16, …
‘Windowing’, false, …
‘OversamplingFactor’, 1, …
‘NumSymbols’, 100, …
‘NumTransmitAntennas’, 1, …
‘PilotInputPort’, false);

scs = 1000000;
M = 4; % Modulation order
% input bit source:
in = randi([0 1], 10600, 1);
dataInput = qammod(in, M, ‘gray’, ‘InputType’, ‘bit’, ‘UnitAveragePower’, true);
ofdmInfo = info(ofdmMod);
ofdmSize = ofdmInfo.DataInputSize;
dataInput = reshape(dataInput,
ofdmSize);
% Generation
waveform = ofdmMod(dataInput);
Fs = ofdmMod.FFTLength * scs * ofdmMod.OversamplingFactor;
% Specify the sample rate of the waveform in Hz
%% Visualize
% Spectrum Analyzer
spectrum = spectrumAnalyzer(‘SampleRate’, Fs);
spectrum(waveform);
release(spectrum);
% Constellation Diagram
constel = comm.ConstellationDiagram(‘ColorFading’, true, …
‘ShowTrajectory’, 0, …
‘ShowReferenceConstellation’, false);
constel(waveform);
release(constel);
% OFDM Subcarrier Mapping
showResourceMapping(ofdmMod);
CONTENT BEYOND SYLLABUS
EXP NO: 7 5G Complaint waveform for OFDM, QAM and
PSK Date:

AIM:
Develop a MATLAB program to 5G Complaint waveform for OFDM,QAM and PSK.
APPARATUSREQUIRED:
 Hardware: Personal computer
 Software :MATLAB , 5GToolbox,knowledge of 5G NR standard.
PROCEDURE:
9. Start the MATLAB 2023a
10. Open M file
11. Type the program
12. Save in the current Directory
13. Compile and Run the Program
14. If any error occurs in the program correct and run it again
15. For the output see current window/ Figure window
16. Stop the Program.
OUTPUT:
QAM WAVEFORM:

%% Generating QAM waveform


% QAM configuration
M = 4; % Modulation order
% input bit source:
in = randi([0, 1], 60000, 1);
% Generation
waveform = qammod(in, M, 'gray', 'InputType', 'bit', 'UnitAveragePower', true);

Fs = 1000; % Specify the sample rate of the waveform in Hz

%% Visualize
% Time Scope
timeScope = timescope('SampleRate', Fs, ...
'TimeSpanOverrunAction', 'scroll', ...
'TimeSpanSource', 'property', ...
'TimeSpan', 0.03);
timeScope(waveform);
release(timeScope);

% Spectrum Analyzer
spectrum = spectrumAnalyzer('SampleRate',
Fs); spectrum(waveform);
release(spectrum);

% Constellation Diagram
constel = comm.ConstellationDiagram('ColorFading', true,
... 'ShowTrajectory', 0, ...
'ShowReferenceConstellation', false);
constel(waveform);
release(constel);
OUTPUT:
PSK WAVEFORM Coding:

%% Generating PSK waveform


% PSK configuration
M = 4; % Modulation order
% input bit source:
in = randi([0, 1], 60000, 1);
usedInput =
in(1:log2(M)*(floor(length(in)/log2(M))));
symbolInput = bit2int(usedInput, log2(M));
% Generation
phaseOffset = pi/M;
waveform = pskmod(symbolInput, M, phaseOffset,
‘gray’); Fs = 1000;
% Specify the sample rate of the waveform in Hz
%% Visualize
% Time Scope
timeScope = timescope(‘SampleRate’, Fs, …
‘TimeSpanOverrunAction’, ‘scroll’, …
‘TimeSpanSource’, ‘property’, …
‘TimeSpan’, 0.03);
timeScope(waveform);
release(timeScope);
% Spectrum Analyzer
spectrum = spectrumAnalyzer(‘SampleRate’, Fs);
spectrum(waveform);
release(spectrum);
% Constellation Diagram
constel = comm.ConstellationDiagram(‘ColorFading’, true, …
‘ShowTrajectory’, 0, …
‘ShowReferenceConstellation’, false);
constel(waveform);
release(constel);
OUTPUT:

RESULT:

You might also like