Compute number of symbol errors and symbol error rate

`[number,ratio] = symerr(x,y) `

[number,ratio] = symerr(x,y,* flg*)

[number,ratio,loc] = symerr(...)

The `symerr`

function compares binary representations
of elements in `x`

with those in `y`

.
The schematics below illustrate how the shapes of `x`

and `y`

determine
which elements `symerr`

compares.

The output `number`

is a scalar or vector that
indicates the number of elements that differ. The size of `number`

is
determined by the optional input * flg* and
by the dimensions of

`x`

and `y`

.
The output `ratio`

equals `number`

divided
by the total number of elements in the `[number,ratio] = symerr(x,y) `

compares
the elements in `x`

and `y`

. The
sizes of `x`

and `y`

determine which
elements are compared:

If

`x`

and`y`

are matrices of the same dimensions, then`symerr`

compares`x`

and`y`

element by element.`number`

is a scalar. See schematic (a) in the figure.If one is a row (respectively, column) vector and the other is a two-dimensional matrix, then

`symerr`

compares the vector element by element with*each row (resp., column)*of the matrix. The length of the vector must equal the number of columns (resp., rows) in the matrix.`number`

is a column (resp., row) vector whose mth entry indicates the number of elements that differ when comparing the vector with the mth row (resp., column) of the matrix. See schematics (b) and (c) in the figure.

`[number,ratio] = symerr(x,y,`

is
similar to the previous syntax, except that * flg*)

`flg`

`symerr`

compares
and how `symerr`

computes the outputs. The values
of `flg`

`'overall'`

`'column-wise'`

`'row-wise'`

`ratio`

is `number`

divided
by the total number of elements in `y`

. **Comparing a Two-Dimensional Matrix x with Another
Input y**

Shape of y | flg | Type of Comparison | number |
---|---|---|---|

Two-dim. matrix | (default) `'overall'` | Element by element | Total number of symbol errors |

`'column-wise'` | mth column of `x` vs.
mth column of `y` | Row vector whose entries count symbol errors in each column | |

`'row-wise'` | mth row of `x` vs.
mth row of `y` | Column vector whose entries count symbol errors in each row | |

Column vector | `'overall'` | `y` vs.
each column of `x` | Total number of symbol errors |

(default) `'column-wise'` | `y` vs.
each column of `x` | Row vector whose entries
count symbol errors in each column of `x` | |

Row vector | `'overall'` | `y` vs.
each row of `x` | Total number of symbol errors |

(default) `'row-wise'` | `y` vs.
each row of `x` | Column vector whose entries
count symbol errors in each row of `x` |

`[number,ratio,loc] = symerr(...)`

returns
a binary matrix `loc`

that indicates which elements
of `x`

and `y`

differ. An element
of `loc`

is zero if the corresponding comparison
yields no discrepancy, and one otherwise.

On the reference page for `biterr`

,
the last example uses `symerr`

.

The command below illustrates how `symerr`

works
when one argument is a vector and the other is a matrix. It compares
the vector `[1,2,3]'`

to the columns

$$\left[\begin{array}{c}1\\ 3\\ 3\end{array}\right]\text{,}\left[\begin{array}{c}1\\ 2\\ 3\end{array}\right]\text{,}\left[\begin{array}{c}3\\ 2\\ 8\end{array}\right]\text{,and}\left[\begin{array}{c}1\\ 2\\ 3\end{array}\right]$$

of the matrix.

num = symerr([1 2 3]',[1 1 3 1;3 2 2 2; 3 3 8 3]) num = 1 0 2 0

As another example, the command below illustrates the use of * flg* to
override the default row-by-row comparison. Notice that

`number`

and `ratio`

are
scalars.format rat; [number,ratio,loc] = symerr([1 2; 3 4],[1 3],'overall')

The output is below.

number = 3 ratio = 3/4 loc = 0 1 1 1

Was this topic helpful?