| Communications Toolbox | ![]() |
A binary symmetric channel corrupts a binary signal by reversing each bit with a fixed probability. Such a channel can be useful for testing error-control coding.
To model a binary symmetric channel, use the bsc function. The two input arguments are the binary signal and the probability, p.
If you want to model a binary channel whose statistical description involves the number of errors per codeword, then see the description of randerr in Random Bit Error Patterns.
The example below introduces bit errors in a convolutional code with probability 0.01.
t = poly2trellis([4 3],[4 5 17;7 4 2]); % Trellis msg = ones(10000,1); % Data to encode code = convenc(ones(10000,1),t); % Encode using convolutional code. [ncode,err] = bsc(code,.01); % Introduce errors in code. numchanerrs = sum(sum(err)) % Number of channel errors dcode = vitdec(ncode,t,2,'trunc','hard'); % Decode. [numsyserrs,ber] = biterr(dcode,msg) % Errors after decoding
The output below shows that the decoder corrects some, but not all, of the errors that bsc introduced into the code. Your results might vary because the channel errors are random.
numchanerrs =
132
numsyserrs =
27
ber =
0.0027
| Using the Channel Visualization Tool | Selected Bibliography for Channels | ![]() |
© 1994-2005 The MathWorks, Inc.