Sie sind auf Seite 1von 6

Induction To Data Communications MATLAB Workshop

Reducing the Error Rate Using a Hamming Code


O!ecti"e: to reduce the error rate in Channel Noise Model by using a Hamming
code.
Too#s: MATLAB, Simulink, Communications Blockset.
$rocedure :
A. Start MATLAB by doubleclicking the MATLAB icon or go to !start" and
!#rogram", then search $or the MATLAB #rogram $older and then click the
!MATLAB".
B. Ty#e in simulink to o#en a ne% %indo%. Click on the !Communications
Blockset", it %ill o#en all sublibraries o$ communications.
C%Bui#ding the Hamming Code Mode#
&. Ty#e channeldoc at the MATLAB #rom#t to o#en the channel noise model. Then
sa'e the model as my(hamming in the directory %here you kee# your %ork $iles.
). *rag the $ollo%ing t%o Communications Blockset blocks $rom the Simulink
Library Bro%ser into the model %indo%:
Hamming +ncoder block, $rom the Block sublibrary o$ the +rror *etection
and Correction library
Hamming *ecoder block, $rom the Block sublibrary o$ the +rror *etection
and Correction library
,. Click the right border o$ the model and drag it to the right to %iden the model
%indo%.
Reducing the Error Rate Using a Hamming Code
ECCE Communication Lab -age &
Induction To Data Communications MATLAB Workshop
.. Mo'e the Binary Symmetric Channel block, the +rror /ate Calculation block, and
the *is#lay block to the right by clicking and dragging. This creates more s#ace
bet%een the Binary Symmetric Channel block and the blocks ne0t to it. The model
should no% look like the $ollo%ing $igure.

1. Click the Hamming +ncoder block and drag it on to# o$ the line bet%een the
Bernoulli Binary 2enerator block and the Binary Symmetric Channel block, to the
right o$ the branch #oint, as sho%n in the $ollo%ing $igure. Then release the mouse
button. The Hamming +ncoder block should automatically connect to the line
$rom the Bernoulli Binary 2enerator block to the Binary Symmetric Channel
block.
3. Click the Hamming *ecoder block and drag it on to# o$ the line bet%een the
Binary Symmetric Channel block and the +rror /ate Calculation block.
&% 'etting $arameters in the Hamming Code Mode#
*oubleclick the Bernoulli Binary 2enerator block and make the $ollo%ing changes to
the #arameter settings in the block4s dialog bo0, as sho%n in the $ollo%ing $igure:
(% Lae#ing the Disp#a) B#ock
5ou can change the label that a##ears belo% a block to make it more in$ormati'e. 6or
e0am#le, to change the label belo% the *is#lay block to 7+rror /ate *is#lay,7 $irst
select the label %ith the mouse. This causes a bo0 to a##ear around the te0t. +nter the
changes to the te0t in the bo0.
Reducing the Error Rate Using a Hamming Code
ECCE Communication Lab -age )
Induction To Data Communications MATLAB Workshop
*% Running the Hamming Code Mode#
To run the model, select Simulation 8 Start. The model terminates a$ter &99 errors
occur. The error rate, dis#layed in the to# %indo% o$ the *is#lay block, is
a##ro0imately .99&.
+% Ans,er -o##o,ing .uestions
&. Change the :nitial seed #arameters in the model or run a simulation $or a
di$$erent length o$ time. ;hat is the error rate dis#layed in the to# %indo% o$ the
*is#lay block<
). ;hy the error rate is al%ays a##ro0imately 9.99& %hen the channel error is 9.9&<
,. Change the channel error #robability to 9.9), 9.9,=. ;hat is the error rate a$ter
the Hamming decoding< Com#are your simulation results and theoretical results.
.. Ho% to obtain a lo%er error rate $or the same #robability o$ error<

/Optiona#0 ,hen )ou ha"e -inished a## ao"e steps1


Disp#a)ing 2rame 'i3es
5ou can dis#lay the si>es o$ data $rames in di$$erent #arts o$ the model by selecting
Signal dimensions $rom the -ort?signal dis#lays submenu o$ the 6ormat menu at the
to# o$ the model %indo%. This is sho%n in the $ollo%ing $igure. The line leading out
o$ the Bernoulli Binary 2enerator block is labeled @.0&A, indicating that its out#ut
consists o$ column 'ectors o$ si>e .. Because the Hamming +ncoder block uses a
@B,.A code, it con'erts $rames o$ si>e . into $rames o$ si>e B, so its out#ut is labeled
@B0&A.
Adding a 'cope to the Mode#
To dis#lay the channel errors #roduced by the Binary Symmetric Channel block, add a
Sco#e block to the model. This is a good %ay to see %hether your model is
$unctioning correctly. The e0am#le sho%n in the $ollo%ing $igure sho%s %here to
insert the Sco#e block into the model.
Reducing the Error Rate Using a Hamming Code
ECCE Communication Lab -age ,
Induction To Data Communications MATLAB Workshop
'etting $arameters in the E4panded Mode#
Make the $ollo%ing changes to the #arameters $or the blocks you added to the model.
Error Rate Ca#cu#ation B#ock
*oubleclick the +rror /ate Calculation block and clear the bo0 ne0t to Sto#
simulation in the block4s dialog bo0.
'cope B#ock
The Sco#e block dis#lays the channel errors and uncorrected errors. To con$igure the
block,
*oubleclick the block to o#en the sco#e, i$ it is not already o#en.
Click the -arameters button on the toolbar.
Set Time range to 1999.
Click the *ata history tab.
Ty#e ,9999 in the Limit data #oints to last $ield, and click CD.
The sco#e should no% a##ear as sho%n.
To con$igure the a0es, $ollo% these ste#s:
/ightclick the 'ertical a0is at the le$t side o$ the u##er sco#e.
:n the conte0t menu, select A0es #ro#erties.
:n the 5min $ield, ty#e &.
:n the 5ma0 $ield, ty#e ), and click CD.
/e#eat the same ste#s $or the 'ertical a0is o$ the lo%er sco#e.
Reducing the Error Rate Using a Hamming Code
ECCE Communication Lab -age .
Induction To Data Communications MATLAB Workshop
;iden the sco#e %indo% until it is roughly three times as %ide as it is high.
5ou can do this by clicking the right border o$ the %indo% and dragging the
border to the right, %hile #ressing the mouse button.
Re#ationa# Operator
Set /elational C#erator to EF in the block4s dialog bo0. The /elational C#erator block
com#ares the transmitted signal, coming $rom the Bernoulli /andom 2enerator block,
%ith the recei'ed signal, coming $rom the Hamming *ecoder block. The block
out#uts a 9 %hen the t%o signals agree and a & %hen they disagree.
Oser"ing Channe# Errors ,ith the 'cope
;hen you run the model, the Sco#e block dis#lays the error data. At the end o$ each
1999 time ste#s, the sco#e a##ears as sho%n in the $ollo%ing $igure. The sco#e then
clears the dis#layed data and dis#lays the ne0t 1999 data #oints.
Sco#e %ith Model /unning
The u##er sco#e sho%s the channel errors generated by the Binary Symmetric
Channel block. The lo%er sco#e sho%s errors that are not corrected by channel
coding.
Click the Sto# button on the toolbar at the to# o$ the model %indo% to sto# the sco#e.
To >oom in on the sco#e so that you can see indi'idual errors, $irst click the middle
magni$ying glass button at the to# le$t o$ the Sco#e %indo%. Then click one o$ the
lines in the lo%er sco#e. This >ooms in hori>ontally on the line. Continue clicking the
lines in the lo%er sco#e until the hori>ontal scale is $ine enough to detect indi'idual
errors. A ty#ical e0am#le o$ %hat you might see is sho%n in the $igure belo%.
Gooming :n on the Sco#e
Reducing the Error Rate Using a Hamming Code
ECCE Communication Lab -age 1
Induction To Data Communications MATLAB Workshop
The %ider rectangular #ulse in the middle o$ the u##er sco#e re#resents t%o &s. These
t%o errors, %hich occur in a single code%ord, are not corrected. This accounts $or the
uncorrected errors in the lo%er sco#e. The narro%er rectangular #ulse to the right o$
the u##er sco#e re#resents a single error, %hich is corrected.
;hen you are done obser'ing the errors, select Simulation 8 Sto#.
E4p#ain ho, to send the error data to the MATLAB ,orkspace -or more detai#ed
ana#)sis%
Reducing the Error Rate Using a Hamming Code
ECCE Communication Lab -age 3

Das könnte Ihnen auch gefallen