This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

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.


Model binary symmetric channel


ndata = bsc(data,p)
ndata = bsc(data,p,s)
ndata = bsc(data,p,state)
[ndata,err] = bsc(...)


ndata = bsc(data,p) passes the binary input signal data through a binary symmetric channel with error probability p. The channel introduces a bit error with probability p, processing each element of data independently. data must be an array of binary numbers or a Galois array in GF(2). p must be a scalar between 0 and 1.ndata = bsc(data,p,s) causes rand to use the random stream s. s is any valid random stream. See RandStream for more details.

ndata = bsc(data,p,state) resets the state of the uniform random number generator rand to the integer state.

    Note:   This usage is deprecated and may be removed in a future release. Instead of state, use s, as in the previous example.

[ndata,err] = bsc(...) returns an array, err, containing the channel errors.

This function uses, by default, the Mersenne Twister algorithm by Nishimura and Matsumoto.

    Note:   Using the state parameter causes this function to switch random generators to use the 'state' algorithm of the rand function.

    See rand for details on the generator algorithm.


To introduce bit errors in the bits in a random matrix with probability 0.15, use the bsc function:

z = randi([0 1],100,100); % Random matrix
nz = bsc(z,.15); % Binary symmetric channel
[numerrs, pcterrs] = biterr(z,nz) % Number and percentage of errors

The output below is typical. The percentage of bit errors is not exactly 15% in most trials, but it is close to 15% if the size of the matrix z is large.

numerrs =


pcterrs =


Another example using this function is in Design a Rate 2/3 Feedforward Encoder Using Simulink.

See Also


Introduced before R2006a

Was this topic helpful?