| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Communications Toolbox |
| Contents | Index |
| Learn more about Communications Toolbox |
| On this page… |
|---|
Using Simulated Data to Compute Bit and Symbol Error Rates |
One way to compute the bit error rate or symbol error rate for a communication system is to simulate the transmission of data messages and compare all messages before and after transmission. The simulation of the communication system components using Communications Toolbox is covered in other parts of this guide. This section describes how to compare the data messages that enter and leave the simulation.
Another example of computing performance results via simulation is in Curve Fitting for Error Rate Plots in the discussion of curve fitting.
The biterr function compares two sets of data and computes the number of bit errors and the bit error rate. The symerr function compares two sets of data and computes the number of symbol errors and the symbol error rate. An error is a discrepancy between corresponding points in the two sets of data.
Of the two sets of data, typically one represents messages entering a transmitter and the other represents recovered messages leaving a receiver. You might also compare data entering and leaving other parts of your communication system, for example, data entering an encoder and data leaving a decoder.
If your communication system uses several bits to represent one symbol, counting bit errors is different from counting symbol errors. In either the bit- or symbol-counting case, the error rate is the number of errors divided by the total number (of bits or symbols) transmitted.
Note To ensure an accurate error rate, you should typically simulate enough data to produce at least 100 errors. |
If the error rate is very small (for example, 10-6 or smaller), the semianalytic technique might compute the result more quickly than a simulation-only approach. See Performance Results via the Semianalytic Technique for more information on how to use this technique.
The script below uses the symerr function to compute the symbol error rates for a noisy linear block code. After artificially adding noise to the encoded message, it compares the resulting noisy code to the original code. Then it decodes and compares the decoded message to the original one.
m = 3; n = 2^m-1; k = n-m; % Prepare to use Hamming code. msg = randint(k*200,1,2); % 200 messages of k bits each code = encode(msg,n,k,'hamming'); codenoisy = rem(code+(rand(n*200,1)>.95),2); % Add noise. % Decode and correct some errors. newmsg = decode(codenoisy,n,k,'hamming'); % Compute and display symbol error rates. [codenum,coderate] = symerr(code,codenoisy); [msgnum,msgrate] = symerr(msg,newmsg); disp(['Error rate in the received code: ',num2str(coderate)]) disp(['Error rate after decoding: ',num2str(msgrate)])
The output is below. The error rate decreases after decoding because the Hamming decoder corrects some of the errors. Your results might vary because this example uses random numbers.
Error rate in the received code: 0.054286 Error rate after decoding: 0.03
In the example above, the symbol errors and bit errors are the same because each symbol is a bit. The commands below illustrate the difference between symbol errors and bit errors in other situations.
a = [1 2 3]'; b = [1 4 4]'; format rat % Display fractions instead of decimals. [snum,srate] = symerr(a,b) [bnum,brate] = biterr(a,b)
The output is below.
snum =
2
srate =
2/3
bnum =
5
brate =
5/9
bnum is 5 because the second entries differ in two bits and the third entries differ in three bits. brate is 5/9 because the total number of bits is 9. The total number of bits is, by definition, the number of entries in a or b times the maximum number of bits among all entries of a and b.
![]() | Performance Evaluation | Performance Results via the Semianalytic Technique | ![]() |

Learn how to apply early verification to your development process through these technical resources.
How much time do you spend on testing to ensure implementation meets system-level requirements?
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |