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

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

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

Generate bit error patterns

`out = randerr(m)`

`out = randerr(m,n)`

`out = randerr(m,n,errors)`

`out = randerr(m,n,errors,seed)`

`out = randerr(m,n,errors,streamhandle)`

For all syntaxes, `randerr`

treats each row of `out`

independently.

`out = randerr(m)`

generates an
`m`

-by-`m`

binary matrix, where each row has
exactly one nonzero entry in a random position. Each allowable configuration has an
equal probability.

`out = randerr(m,n)`

generates an
`m`

-by-`n`

binary matrix, where each row has
exactly one nonzero entry in a random position. Each allowable configuration has an
equal probability.

`out = randerr(m,n,errors)`

uses the
`errors`

input to determine the number of nonzero entries in
each row of the output `m`

-by-`n`

binary matrix.

If

`errors`

is a scalar, it is the number of nonzero entries in each row.If

`errors`

is a row vector, it lists the possible number of nonzero entries in each row.If

`errors`

is a matrix having two rows, the first row lists the possible number of nonzero entries in each row and the second row lists the probabilities that correspond to the possible error counts. The elements in the second row of`errors`

must sum to one.

Once `randerr`

determines the number of nonzero
entries in a given row, each configuration of that number of nonzero entries has
equal probability.

`out = randerr(m,n,errors,seed)`

accepts a
seed value for initializing the uniform random number generator `rand`

.

`out = randerr(m,n,errors,streamhandle)`

accepts a random stream handle to generate uniform random noise samples by using
`rand`

. Providing a random stream
handle or using the `reset`

function on the default
random stream object enables you to generate repeatable noise samples. If you want
to generate repeatable noise samples, then either reset the random stream input
before calling `randerr`

or use the same seed input. For more
information, see `RandStream`

.

Was this topic helpful?