<< Chapter < Page | Chapter >> Page > |
The second part carries out the encoding and decoding
process. The variable
p
specifies the chance
that bit errors will occur in the transmission.The code words
c
are constructed using the
generator matrix. The received signal is multipliedby the parity check matrix
h
to give the syndrome,
which is then used as an index into the syndrometable (matrix)
syn
. The resulting “most likely error”
is subtracted from the received signal, and thisis the “corrected” code word that is translated
back into the message.Because the code is linear, code words can be
translated back into the message using an“inverse” matrix
This is explored in the context
of
blockcode52.m
in Exercise
[link] . and there is no need to store all the
code words. This becomes important when there are millionsof possible code words, but when there are only
four it is not crucial. The translation is done in
blockcode52.m
in the
for j
loop with by searching.
Running
blockcode52.m
with the default parameters
of
bit errors and length
m=10000
will give about
400 errors, a rate of about
. Actually, as will be shown
in the next section, the performance of this code is slightly betterthan these numbers suggest, because it is also
capable of detecting certain errors that it cannot correct, and thisfeature is not implemented in
blockcode52.m
.
Use
blockcode52.m
to investigate the performance of
the binary
code. Let
p
take on a variety of
values
and plot
the percentage of errors as a function of the percentageof bits flipped.
This exercise compares the performance of the
(5,2) block code in a more “realistic” settingand provides a good warm-up exercise for
the receiver to be built in Chapter
[link] .
The program
nocode52.m
(all M
atlab files
are available on the website) provides a template with which you can addthe block coding into a “real” transmitter and receiver pair.
Observe, in particular, that the block coding is placed after thetranslation of the text into binary but before the translation
into 4-PAM (for transmission). For efficiency, the text is encodedusing
text2bin.m
(recall Example
[link] ).
At the receiver, the process isreversed: the raw 4-PAM data is translated into binary, then
decoded using the (5,2) block decoder, and finally translatedback into text (using
bin2text.m
) where you can read it.
Your task in this problem is to experimentally verify thegains possible when using the (5,2) code.
First, merge the programs
blockcode52.m
and
nocode52.m
.
Measure the number of errors that occur as noise is increased(the variable
varnoise
scales the noise).
Make a plot of the number of errors as the variance increases.Compare this with the number of errors that occur as the
variance increases when no coding is used (i.e., running
nocode52.m
without modification).
Use the matrix
ginv=[1 1;1 0 ;0 0;1 0;0 1];
to replace the
for j
loop in
blockcode52.m
.
Observe that this reverses the effect of constructingthe code words from the
x
since
cw*ginv=x (mod 2)
.
Implement the simple majority rules code described in [link] .
Notification Switch
Would you like to follow the 'Software receiver design' conversation and receive update notifications?