Note: This page has been translated by MathWorks. Please click here

To view all translated materials including this page, select Japan from the country navigator on the bottom of this page.

To view all translated materials including this page, select Japan from the country navigator on the bottom of this page.

Block decoder

`msg = decode(code,n,k,'`

`hamming/`

* fmt*',prim_poly)

msg = decode(code,n,k,'

`linear/`

`fmt`

msg = decode(code,n,k,'

`cyclic/`

`fmt`

msg = decode(code,n,k)

[msg,err] = decode(...)

[msg,err,ccode] = decode(...)

[msg,err,ccode,cerr] = decode(...)

Input | Default Value |
---|---|

`fmt` | `binary` |

`prim_poly` | `gfprimdf(m)` where `n = 2^m-1` |

`genpoly` | `cyclpoly` `(n,k)` |

`trt ` | Uses `syndtable` to
create the syndrome decoding table associated with the method's parity-check
matrix |

The `decode`

function aims to recover messages
that were encoded using an error-correction coding technique. The
technique and the defining parameters must match those that were used
to encode the original signal.

The For All Syntaxes section on the `encode`

reference
page explains the meanings of `n`

and `k`

,
the possible values of * fmt*, and the possible
formats for

`code`

and `msg`

. You
should be familiar with the conventions described there before reading
the rest of this section. Using the `decode`

function
with an input argument `code`

that was `encode`

function might cause errors.`msg = decode(code,n,k,'`

decodes `hamming/`

* fmt*',prim_poly)

`code`

using
the Hamming method. For this syntax, `n`

must have
the form 2`k`

must equal `n`

-m. `prim_poly`

is
a polynomial character vector or
a row vector that gives the binary coefficients, in order of ascending
powers, of the primitive polynomial for GF(2`prim_poly`

is `gfprimdf`

(m). The decoding table that the
function uses to correct a single error in each codeword is `syndtable`

(`hammgen`

(m)).`msg = decode(code,n,k,'`

decodes `linear/`

* fmt*',genmat,trt)

`code`

,
which is a linear block code determined by the `k`

-by-`n`

generator
matrix `genmat`

. `genmat`

is required
as input. `decode`

tries to correct errors using
the decoding table `trt`

, where `trt`

is
a `2^(n-k)`

-by-`n`

matrix.`msg = decode(code,n,k,'`

decodes
the cyclic code `cyclic/`

* fmt*',genpoly,trt)

`code`

and tries to correct errors
using the decoding table `trt`

, where `trt`

is
a `2^(n-k)`

-by-`n`

matrix. `genpoly`

is
a polynomial character vector or
a row vector that gives the coefficients, in order of ascending powers,
of the binary generator polynomial of the code. The default value
of `genpoly`

is `cyclpoly`

`(n,k)`

.
By definition, the generator polynomial for an [`n`

, `k`

]
cyclic code must have degree `n-k`

and must divide
x`-1`

.`msg = decode(code,n,k)`

is
the same as `msg = decode(code,n,k,'hamming/binary')`

.

`[msg,err] = decode(...)`

returns
a column vector `err`

that gives information about
error correction. If the code is a convolutional code, `err`

contains
the metric calculations used in the decoding decision process. For
other types of codes, a nonnegative integer in the rth row of `err`

indicates
the number of errors corrected in the rth *message* word;
a negative integer indicates that there are more errors in the rth
word than can be corrected.

`[msg,err,ccode] = decode(...)`

returns
the corrected code in `ccode`

.

`[msg,err,ccode,cerr] = decode(...)`

returns
a column vector `cerr`

whose meaning depends on the
format of `code`

:

If

`code`

is a binary vector, a nonnegative integer in the rth row of`vec2mat`

`cerr`

indicates the number of errors corrected in the rth*codeword*; a negative integer indicates that there are more errors in the rth codeword than can be corrected.If

`code`

is not a binary vector,`cerr = err`

.

Depending on the decoding method, `decode`

relies
on such lower-level functions as `hammgen`

, `syndtable`

, and `cyclgen`

.

Was this topic helpful?