MATLAB-Hamming codes.doc

May 12, 2018 | Author: Tân Chip | Category: Telecommunications, Computing, Technology, Computer Data, Areas Of Computer Science
Share Embed Donate


Short Description

Download MATLAB-Hamming codes.doc...

Description

Induction Induct ion To Data Communications Communica tions

MATLAB 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, MATLAB, Simulink, Communications Blockset. $roce $ro cedu dure re : A. Star Startt MAT MATLAB LAB by doub double lecl clic icki king ng the the MAT MATLAB LAB icon icon or go to !sta !start rt"" and and !#rogr !#rogram" am",, then then search search $or the MAT MATLAB #rogra #rogram m $older $older and then then click click the !MATLAB". B. Ty#e in simulink  to o#en a ne% %indo%. Click on the !Communications Blockset", it %ill o#en all sublibraries o$ communications.

C%Bui#ding the Hamming Code Mode#

&. Ty#e channeldoc at the MATLAB MATLAB #rom#t to o#en the channel c hannel noise model. Then sa'e the model as my(hamming in the directory %here you kee# your %ork $iles. ). *rag the the $ollo%ing $ollo%ing t%o t%o Communicati Communications ons Blockset Blockset blocks blocks $rom $rom the Simulink 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 the right border border o$ o$ the model model and drag drag it to the right right to %iden %iden the 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#

*oubleclick 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:

(% Lae#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## ao"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&, indicating that its out#ut consists o$ column 'ectors o$ si>e . Because the Hamming +ncoder block uses a @, code, it con'erts $rames o$ si>e  into $rames o$ si>e , so its out#ut is labeled @0&.

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  *oubleclick 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, • • • • •

*oubleclick 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 D.

The sco#e should no% a##ear as sho%n.

To con$igure the a0es, $ollo% these ste#s: /ightclick the 'ertical a0is at the le$t side o$ the u##er sco#e. • n the conte0t menu, select A0es #ro#erties. • n the 5min $ield, ty#e &. • n the 5ma0 $ield, ty#e ), and click D. • /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 #erator to EF in the block4s dialog bo0. The /elational #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. Oser"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

View more...

Comments

Copyright ©2017 KUPDF Inc.
SUPPORT KUPDF