⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hcomcode.htm

📁 Proakis《contemporarycommunication systems using matlab》matlab源代码
💻 HTM
字号:
<TITLE>Communications Toolbox Error-Control Coding</TITLE>
<h2>Error-Control Coding</h2>
You can use this toolbox to perform block error-control coding
and convolution error-control coding computations. The toolbox contains a
SIMULINK <A RUN="closebut(gcf);com_code">Error-Control Coding Library</A>,
which can be further divided into the following sublibraries:
<dl>
<dd> <A RUN="closebut(gcf);comcdham">Hamming Code</A>
<dd> <A RUN="closebut(gcf);comcdbch">BCH Code</A>
<dd> <A RUN="closebut(gcf);comcdrs">Reed-Solomon Code</A>
<dd> <A RUN="closebut(gcf);comcdcyc">Cyclic Code</A>
<dd> <A RUN="closebut(gcf);comcdlin">Linear Block Code</A>
<dd> <A RUN="closebut(gcf);comcdcon">Convolution Code</A>
</dl><p>
You can view a list of
 <a href="htb_code.html">all SIMULINK blocks</a> in the Error-Control Coding
category. <p>

There are two major MATLAB functions for error-control coding computation:
<dl>
<dd><b><a run="hthelp encode">encode</a></b> - Encode computation for error-control coding methods.
<dd><b><a run="hthelp decode">decode</a></b> - Decode computation for error-control coding methods.
</dl><p>
There are some other supporting functions in this category:
<dl>
<dd><b><a run="hthelp rsencof">rsencof</a></b> - Encode a text file using Reed-Solomon code.
<dd><b><a run="hthelp rsdecof">rsdecof</a></b> - Decode a Reed-Solomon code encoded text file.
<dd><b><a run="hthelp bchpoly">bchpoly</a></b> - BCH code generator polynomial.
<dd><b><a run="hthelp cyclgen">cyclgen</a></b> - Cyclic code generator and parity-check matrices.
<dd><b><a run="hthelp cyclpoly">cyclpoly</a></b> - Cyclic generator polynomial.
<dd><b><a run="hthelp gen2par">gen2par</a></b> - Generator matrix to parity-check matrix conversion.
<dd><b><a run="hthelp hammgen">hammgen</a></b> - Hamming code generator and parity-check matrices.
<dd><b><a run="hthelp htruthtb">htruthtb</a></b> - Truth table from generator or parity check matrix.
<dd><b><a run="hthelp oct2gen">oct2gen</a></b> - Convolution code octal form to binary form conversion.
<dd><b><a run="hthelp sim2tran">sim2gen</a></b> - Convolution code binary from SIMULINK block diagram.
</dl><p>

The following four examples show how to use the toolbox for error-control 
coding computation.<p>

<A RUN="closebut(gcf);hrscodec;">
Example 1: Using Reed-Solomon Code</A> (RS) for text file error-control coding.
<dl>
<dd>This example codes a ASCII text file using Reed-Solomon code. The example
generates a figure showing the stages of the text files. The original
text shows at the top-left corner. The coded file shows at the top
right corner. Assume some errors will occur in the data 
transmission or storage. The text with error shows at the bottom-right 
of the figure. Note that all <b>$$</b> signs are errors added to the
file. The RS decode takes the file with noise and outputs the decoded
file at the bottom-left of the figure.
The simulation uses the commands:
<dl><tt>
<dd>% encode
<dd><a run="hthelp rsencof">rsencof</a> rstemp.tst temp.cod
<dd>% add noise.
<dd>fid = fopen('temp.cod', 'r');
<dd>x   = fread(fid, inf, 'char');
<dd>fclose(fid);
<dd>for i = 30 : 65 : length(x)
<dd>    x(i:i+1) = abs('$$');
<dd>end;
<dd>fid = fopen('temp.noi','w');
<dd>fwrite(fid, x, 'char');
<dd> decode
<dd><a run="hthelp rsencof">rsdecof</a>rsdecof temp.noi temp.dec
</dl></tt>
You can edit the file <tt>temp.cod</tt> to see the decode result. Note
that you can change the characters in the file. You cannot, however,
add or delete characters. Use the following command to recover
the text.
<dl><tt>
<dd>rsdecof temp.noi temp.dec
</dl></tt>
<p>

<A RUN="closebut(gcf);tutbchcd">
Example 2: Using BCH code SIMULINK block</A><p>
<dl>
<dd><A RUN="if ~exist('tutbchcd'),closebut(gcf);tutbchcd;end;junk=rk45('tutbchcd',30);">
Start the simulation</A> for a 30 second simulation. 
<dd>This simulation generates
an error-rate meter figure. The left side of the meter shows the symbols
transfered from the source. The right side of the meter shows the
recovered symbols. The number of symbol/bit, symbol/bit error number, and 
symbol/bit error rates shows at the bottom of the error rate meter.
</dl>
<p>

<A RUN="closebut(gcf);fig_10_9">
Example 3: Using SIMULINK block diagram to construct a transfer function</A>
for convolution code.<p>
<dl>
<dd>The block diagram contains four different blocks: Memory, XOR, Inport,
and Outport. You can change the block diagram structure and then
<A RUN="if ~exist('fig_10_9'),closebut(gcf);fig_10_9;end;tf=sim2gen('fig_10_9')"> click here</A>
for new transfer functions that show at the MATLAB prompt.
</dl>
<p>

<A RUN="closebut(gcf);tutconcd">
Example 4: Convolution code with trellis</A> using SIMULINK block diagram.<p>
<dl>
<dd><A RUN="if ~exist('tutconcd'),closebut(gcf);tutconcd;end;tf=sim2gen('fig_10_9');junk=rk45('tutconcd',15);">
Start the simulation</A> for a 15 second simulation. 
<dd>The trellis figure generated from
the simulation shows the convolution code decision path. The red path is
the decision path. The yellow paths are the survivors. The green circles
are the possible states.
</dl><p>

<dd><a href="commhelp.html">Return to the first page of the tutorial</a>
<dd><a href="hmfasb.html">Return to the functionality listing</a><p>

<tt><dd> This is hcomcode.html file.</tt>


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -