Error Rate Calculation - Compute bit error rate or symbol error rate of input data

Library

Comm Sinks

Description

The Error Rate Calculation block compares input data from a transmitter with input data from a receiver. It calculates the error rate as a running statistic, by dividing the total number of unequal pairs of data elements by the total number of input data elements from one source.

You can use this block to compute either symbol or bit error rate, because it does not consider the magnitude of the difference between input data elements. If the inputs are bits, then the block computes the bit error rate. If the inputs are symbols, then it computes the symbol error rate.

This block inherits the sample time of its inputs.

Input Data

This block has between two and four input ports, depending on how you set the dialog parameters. The inports marked Tx and Rx accept transmitted and received signals, respectively. The Tx and Rx signals must share the same sampling rate.

The Tx and Rx inputs can be either scalars or frame-based column vectors of fixed-point data type, or int8, uint8, int16, uint16, int32, uint32, boolean, single, or double. If Tx is a scalar and Rx is a vector, or vice-versa, then the block compares the scalar with each element of the vector. (Overall, the block behaves as if you had preprocessed the scalar signal with the Communications Blockset™ Repeat block using the Maintain input frame rate option.)

If you check the Reset port box, then an additional inport appears, labeled Rst. The Rst input must be a sample-based scalar signal (of type double or boolean) and must have the same sampling rate as the Tx and Rx signals. When the Rst input is nonzero, the block clears its error statistics and then computes them anew.

If you set the Computation mode parameter to Select samples from port, then an additional inport appears, labeled Sel. The Sel input indicates which elements of a frame are relevant for the computation; this is explained further, in the last subbullet below. The Sel input can be either a sample-based column vector or a one-dimensional vector of type double.

The guidelines below indicate how you should configure the inputs and the dialog parameters depending on how you want this block to interpret your Tx and Rx data.

Output Data

This block produces a vector of length three, whose entries correspond to:

The block sends this output data to the base MATLAB® workspace or to an output port, depending on how you set the Output data parameter:

Delays

The Receive delay and Computation delay parameters implement two different types of delays for this block. One is useful when part of your model causes a lag in the received data, and the other is useful when you want to ignore the transient behavior of both input signals:

If you do not know the receive delay in your model, you can use the Align Signals block, which automatically compensates for the delay. If you use the Align Signals block, you should set the Receive delay in the Error Rate Calculation block to 0.

Alternatively, you can use the Find Delay block to find the value of the delay, and then set the Receive delay parameter in the Error Rate Calculation block to that value.

If you use the Select samples from mask or Select samples from port option, then each delay parameter refers to the number of samples that the block receives, whether the block ultimately ignores some of them or not.

Stopping the Simulation Based on Error Statistics

You can configure this block so that its error statistics control the duration of simulation. This is useful for computing reliable steady-state error statistics without knowing in advance how long transient effects might last. To use this mode, check the Stop simulation check box. The block attempts to run the simulation until it detects Target number of errors errors. However, the simulation stops before detecting enough errors if the time reaches the model's Stop time setting (in the Configuration Parameters dialog box), if the Error Rate Calculation block makes Maximum number of symbols comparisons, or if another block in the model directs the simulation to stop.

To ignore either of the two stopping criteria in this block, set the corresponding parameter (Target number of errors or Maximum number of symbols) to Inf. For example, to reach a target number of errors without stopping the simulation early, set Maximum number of symbols to Inf and set the model's Stop time to Inf.

Examples

The figure below shows how the block compares pairs of elements and counts the number of error events. This example assumes that the sample time of each input signal is 1 second and that the block's parameters are as follows:

The input signals are both frame-based column vectors of length three. However, the schematic arranges each column vector horizontally and aligns pairs of vectors so as to reflect a receive delay of two samples. At each time step, the block compares elements of the Rx signal with those of the Tx signal that appear directly above them in the schematic. For instance, at time 1, the block compares 2, 4, and 1 from the Rx signal with 2, 3, and 1 from the Tx signal.

The values of the first two elements of Rx appear as asterisks because they do not influence the output. Similarly, the 6 and 5 in the Tx signal do not influence the output up to time 3, though they would influence the output at time 4.

In the error rates on the right side of the figure, each numerator at time t reflects the number of errors when considering the elements of Rx up through time t.

If the block's Reset port box had been checked and a reset had occurred at time = 3 seconds, then the last error rate would have been 2/3 instead of 4/10. This value 2/3 would reflect the comparison of 3, 2, and 1 from the Rx signal with 7, 7, and 1 from the Tx signal. The figure below illustrates this scenario.

Tuning Parameters in an RSim Executable (Real-Time Workshop® Software)

If you use the Real-Time Workshop rapid simulation (RSim) target to build an RSim executable, then you can tune the Target number of errors and Maximum number of symbols parameters without recompiling the model. This is useful for Monte Carlo simulations in which you run the simulation multiple times (perhaps on multiple computers) with different amounts of noise.

Dialog Box

Receive delay

Number of samples by which the received data lags behind the transmitted data. (If Tx or Rx is a vector, then each entry represents a sample.)

Computation delay

Number of samples that the block should ignore at the beginning of the comparison.

Computation mode

Either Entire frame, Select samples from mask, or Select samples from port, depending on whether the block should consider all or only part of the input frames.

Selected samples from frame

A vector that lists the indices of the elements of the Rx frame vector that the block should consider when making comparisons. This field appears only if Computation mode is set to Select samples from mask.

Output data

Either Workspace or Port, depending on where you want to send the output data.

Variable name

Name of variable for the output data vector in the base MATLAB workspace. This field appears only if Output data is set to Workspace.

Reset port

If you check this box, then an additional input port appears, labeled Rst.

Stop simulation

If you check this box, then the simulation runs only until this block detects a specified number of errors or performs a specified number of comparisons, whichever comes first.

Target number of errors

The simulation stops after detecting this number of errors. This field is active only if Stop simulation is checked.

Maximum number of symbols

The simulation stops after making this number of comparisons. This field is active only if Stop simulation is checked.

See Also

Align Signals, Find Delay

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS