EE3262 - Assignment 2
EE3262 - Assignment 2
Faculty of Engineering
University of Sri Jayewardenepura
1. Introduction
a. Briefly discuss the difference between hamming distance and hamming code.
1
4. Processing sequences of data words
a. Define the number of words that need to be processed.
numwords = 5
msg = randi([0 1], numwords, 4)
5. Running Simulations
a. Run the ‘Monte Carlo’ simulation for ‘numwords = [Your_Index_No] + 10’ for 3
times and export the generated plots.
c. Run the simulation for 10 words, 100 words, and 100,000 words for a probability bit
error p of 0.1 and export the generated plots.
d. Explain the relationship between the histograms and the number of uncorrected
errors.
e. Try running the simulation with a probability of error p = 0.01. Comment on the
results.
Note:
You have to submit the assignment as a compressed folder which consist of your
assignment report and .m files on or before the due date. All the files should be named as
ENG_XXX_A02 [XXX-Your Index NO].
The report should follow the standard formatting and be well organized with the content.
[Font-Times New Roman, Font size-12, Line spacing-1.5, Alignment-Justify]
All the reports should have the same format for cover page.
Plagiarism will not be tolerated.
Due date will be announced by the Module coordinator and will not be changed for any
reason.
2
Appendix 1 - .m file for Hamming code simulation
n = 7; %Length of the words after coding
k = 4; %Number of message bits
numwords = 10; %The number of words to be encoded and decoded
p = 0.1; %Probability of bit error in the BSC
% Compare the transmitted data before coding and the received data
% after decoding to see where errors have occurred
% The array errsperword contains the number of errors in each word sent.
% In this case we are interested in whether the word is decoded correctly,
% not how many errors it has, so we want to count up the number of words
% with one or more errors:
numwitherr = length(find(errsperword));