Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Matlab Report

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

BSc. ECE 4.

2
EEE2417 SIGNALS AND COMMUNICATION II
MATLAB PRACTICAL REPORT

MEMBERS
ENE212-0265/2018 Allan Alala
ENE212-0242/2020 Faith Ngina
ENE212-0266/2020 Judy Wangechi
ENE212-0268/2020 Tabby Achieng
ENE212-0292/2020 Mirriam Kerubo
Simulation of Reed-Solomon and Convolutional Coding
Introduction
Digital communication systems are designed to transmit information reliably over various types
of channels that can introduce errors into the transmitted signals. To mitigate these errors and
improve the reliability of communication, error-correcting codes like Reed-Solomon and
Convolutional codes are employed. These codes add redundancy to the transmitted information,
allowing the receiver to detect and correct errors that may occur during transmission.

Objective
To evaluate the performance of a communication system utilizing Reed-Solomon and
Convolutional coding schemes under an Additive White Gaussian Noise (AWGN) channel with a
high Signal-to-Noise Ratio (SNR).

Equipment and Software


MATLAB software environment
Communications System Toolbox in MATLAB

Parameters
Reed-Solomon code parameters:
k_rs = 2: Information symbols
n_rs = 7: Total symbols
Convolutional code parameters:
n_conv = 7: Constraint length
k_conv = 1: Information bits per symbol
SNR_dB = 25: Signal-to-Noise Ratio in decibels

Methodology
Initialization: MATLAB environment was prepared by closing all existing figures to ensure a
clear workspace for the simulation.
>> close all;
% Updated parameters
k_rs = 2; % Number of information symbols for Reed-Solomon
n_rs = 7; % Total number of symbols for Reed-Solomon
n_conv = 7; % Constraint length for convolutional code
k_conv = 1; % Number of information bits per symbol for convolutional code
SNR_dB = 25; % Signal-to-Noise Ratio in dB

% Define Reed-Solomon Encoder and Decoder


rsEncoder = comm.RSEncoder(n_rs, k_rs);
rsDecoder = comm.RSDecoder(n_rs, k_rs);

% Define Convolutional Encoder and Decoder


trellis = poly2trellis(n_conv, [171 133]);
convEncoder = comm.ConvolutionalEncoder(trellis, 'TerminationMethod', 'Terminated');
convDecoder = comm.ViterbiDecoder(trellis, 'InputFormat', 'Hard', 'TerminationMethod',
'Terminated', 'TracebackDepth', 7);

% Generate random data


data_size = k_rs * 10; % Adjust to be a multiple of k_rs for simplicity
data = randi([0 1], data_size, 1); % Generating random data

% Reshape data for Reed-Solomon encoding


num_blocks = numel(data) / k_rs;
data_rs = reshape(data, k_rs, num_blocks).';

% Encoding with Reed-Solomon Encoder


encoded_rs = zeros(num_blocks, n_rs);
for i = 1:num_blocks
encoded_rs(i, :) = step(rsEncoder, data_rs(i, :).');
end

% Convert Reed-Solomon symbols to binary


binary_encoded_rs = mod(encoded_rs, 2); % Convert to binary using BPSK modulation

% Reshape encoded data for convolutional encoding


binary_encoded_rs = reshape(binary_encoded_rs.', [], 1); % Convert to column vector

% Encoding with Convolutional Encoder


encoded_conv = step(convEncoder, binary_encoded_rs);

% Add AWGN noise


received_signal = awgn(encoded_conv, SNR_dB, 'measured');

% Decoding with Convolutional Decoder


decoded_conv = step(convDecoder, received_signal);

% Reshape decoded data for Reed-Solomon decoding


decoded_data_rs = zeros(num_blocks, k_rs);
for i = 1:num_blocks
decoded_data_rs(i, :) = step(rsDecoder, decoded_conv((i-1)*n_rs+1:i*n_rs)).';
end
% Reshape decoded data
decoded_data = reshape(decoded_data_rs.', [], 1);

% Calculate Bit Error Rate (BER)


[number_of_errors, ber] = biterr(data, decoded_data);

% Display results
fprintf('Original Data:\n');
disp(data.');
fprintf('Decoded Data:\n');
disp(decoded_data.');
fprintf('Bit Error Rate (BER): %f\n', ber);
Original Data:
0 1 1 0 1 1 1 1 1 1 0 0 1 0 0 0 1 1 1 0

Decoded Data:
1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 0 0

Bit Error Rate (BER): 0.300000

Encoder/Decoder Definition:
A Reed-Solomon encoder and decoder were defined using MATLAB's comm.RSEncoder and
comm.RSDecoder functions, respectively.
A Convolutional encoder and decoder were established with a specified trellis structure and a
termination method set as 'Terminated'. The Viterbi decoder's traceback depth was set to 7.

Data Processing:
Generated a binary data sequence of size data_size = k_rs * 10 to ensure divisibility by k_rs.
Encoded the data using the Reed-Solomon encoder, then converted the symbols to binary for
convolutional encoding.
The Convolutional encoder processed the binary data, which was then transmitted through an
AWGN channel modeled at 25 dB SNR.

Decoding and Analysis:


The received data was decoded using the Viterbi and Reed-Solomon decoders.
Original and decoded data were compared to calculate the Bit Error Rate (BER).
Results
Original Data: A sequence of binary digits representing the transmitted data.
Decoded Data: The output from the decoding process, showing alterations due to noise and
decoding.
BER: Calculated as 0.30, indicating that 30% of the bits were erroneously decoded.

Discussion
The BER of 0.30 is significant and suggests a high error rate despite the high SNR of 25 dB.
This could be due to the following factors:
 Small Block Size: With k_rs = 2, the block size for Reed-Solomon encoding is small,
which may limit error correction capabilities.
 Code Parameters and Depth: The chosen parameters for the convolutional code,
particularly the traceback depth, may not be optimal for the given data size and noise
level, affecting the decoding accuracy.

Conclusion
The simulation demonstrated the impact of coding parameters on the performance of a
communication system under noisy conditions. While Reed-Solomon and Convolutional codes
can effectively reduce errors, their performance is highly dependent on appropriate parameter
selection and operating conditions. Future simulations should explore the effects of varying the
block size, code rate, and traceback depth to optimize the system performance and minimize the
BER.

You might also like