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.
This function uses, by default, the Mersenne Twister algorithm by Nishimura and Matsumoto.
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 = 1509 pcterrs = 0.1509
Another example using this function is in Design a Rate 2/3 Feedforward Encoder Using Simulink.