# Bit Error Rate Analysis

Analyze BER performance of communications systems

## Description

The **Bit Error Rate Analysis** app calculates the bit error rate (BER)
as a function of the energy per bit to noise power spectral density ratio
(*E*_{b}/*N*_{0}).
Using this app, you can:

Generate BER data for a communications system and analyze performance using:

Monte Carlo simulations of MATLAB

^{®}functions and Simulink^{®}models.Theoretical closed-form expressions for selected types of communications systems.

Run systems contained in MATLAB simulation functions or Simulink models. After you create a function or model that simulates the system, the

**Bit Error Rate Analysis**app iterates over your choice of*E*_{b}/*N*_{0}values and collects the results.

Plot one or more BER data sets on a single set of axes. You can graphically compare simulation data with theoretical results or simulation data from a series of communications system models.

Fit a curve to a set of simulation data.

Plot confidence levels of simulation data.

Send BER data to the MATLAB workspace or to a file for further processing.

For more information, see Analyze Performance with Bit Error Rate Analysis App.

## Open the Bit Error Rate Analysis App

MATLAB Toolstrip: On the

**Apps**tab, under**Signal Processing and Communications**, click the app icon.MATLAB command prompt: Enter

`bertool`

.

## Examples

## Parameters

**Theoretical**

`E`_{b}/N_{0} range

— Range of *E*_{b}/*N*_{0}
values

`0:18`

(default) | scalar | vector

_{b}/N

_{0}range

Range of
*E*_{b}/*N*_{0}
values over which the BER is evaluated, specified as a scalar or vector.
Units are in dB.

**Example: **`5:10`

specifies the evaluation of
*E*_{b}/*N*_{0}
values over the range [5, 10] at 1 dB increments.

`Channel type`

— Type of channel over which BER is evaluated

`AWGN`

(default) | `Rayleigh`

| `Rician`

Type of channel over which the BER is evaluated, specified as
`AWGN`

, `Rayleigh`

, or
`Rician`

. The
`Rayleigh`

and
`Rician`

options correspond to flat fading
channels.

`Modulation type`

— Modulation type of communications link

`PSK`

(default) | `DPSK`

| `OQPSK`

| `PAM`

| `QAM`

| `FSK`

| `MSK`

| `CPFSK`

Modulation type of the communications link, specified as
`PSK`

, `DPSK`

,
`OQPSK`

, `PAM`

,
`QAM`

, `FSK`

,
`MSK`

, or
`CPFSK`

.

`Modulation order`

— Modulation order of communications link

`2`

(default) | `4`

| `8`

| `16`

| `32`

| `64`

Modulation order of the communications link, specified as
`2`

, `4`

,
`8`

, `16`

,
`32`

, or `64`

.

`Differential encoding`

— Differential encoding of input data

`off`

(default) | `on`

Select this parameter to enable differential encoding of the input data.

`Correlation coefficient`

— Correlation coefficient

`0`

(default) | real scalar in the range [-1, 1]

Correlation coefficient, specified as a real scalar in the range [-1, 1].

#### Dependencies

To enable this parameter, set **Modulation type** to
`FSK`

.

`Modulation index`

— Modulation index

`0.5`

(default) | positive real scalar

Modulation index, specified as a positive real scalar.

#### Dependencies

To enable this parameter, set **Modulation type** to
`CPFSK`

.

`Demodulation type`

— Coherent demodulation of input data

`on`

(default) | `off`

Select this parameter to enable coherent demodulation of the input data.

Clear this parameter to enable noncoherent demodulation of the input data.

#### Dependencies

To enable this parameter, set **Modulation type** to
`FSK`

or
`MSK`

.

`Channel coding`

— Channel coding type used when estimating theoretical BER

**None** (default) | **Convolutional** | **Block**

Channel coding type used when estimating the theoretical BER, specified as
**None**, **Convolutional**, or
**Block**.

`Synchronization`

— Synchronization error

**Perfect synchronization** (default) | **Normalized timing error** | **RMS phase noise level**

Synchronization error in the demodulation process, specified as
**Perfect synchronization**, **Normalized
timing error**, or **RMS phase noise
(rad)**.

When you set

**Synchronization**to**Perfect synchronization**no synchronization errors are encountered in the demodulation process.When you set

**Synchronization**to**Normalized timing error**, you can set the normalized timing error as a scalar in the range [0, 0.5].When you set

**Synchronization**to**RMS phase noise (rad)**, you can set the RMS phase noise level as a nonnegative scalar. Units are in radians

#### Dependencies

To enable this parameter, set **Modulation type** to
`PSK`

, **Modulation
order** to `2`

, and
**Channel coding** to
**None**.

`Decision method`

— Decoding decision method

`Hard`

(default) | `Soft`

Decoding decision method used to decode the received data, specified as
`Hard`

or
`Soft`

.

#### Dependencies

To enable this parameter, set **Channel coding** to
**Convolutional** or set **Channel
coding** to **Block** and set
**Coding type** to
`General`

.

`Trellis`

— Convolutional code trellis

`poly2trellis(7,[171 133])`

(default) | structure

Convolutional code trellis, specified as a structure variable. You can
generate this structure by using the `poly2trellis`

function.

#### Dependencies

To enable this parameter, set **Channel coding** to
**Convolutional**.

`Coding type`

— Block coding type

`General`

(default) | `Hamming`

| `Golay`

| `Reed-Solomon`

Block coding type used in the BER evaluation, specified as
`General`

, `Hamming`

,
`Golay`

, or
`Reed-Solomon`

.

#### Dependencies

To enable this parameter, set **Channel coding** to
**Block**.

`N`

— Codeword length

positive integer

Codeword length, specified as a positive integer.

#### Dependencies

To enable this parameter, set **Channel coding** to
**Block** and set **Coding type**
to `General`

.

`K`

— Message length

positive integer

Message length, specified as a positive integer such that
**K** is less than **N**.

#### Dependencies

To enable this parameter, set **Channel coding** to
**Block** and set **Coding type**
to `General`

.

`d`_{min}

— Minimum distance of (N,K) block code

positive integer

_{min}

Minimum distance of the (**N**,**K**)
block code, specified as a positive integer.

#### Dependencies

To enable this parameter, set **Channel coding** to
**Block** and set **Coding type**
to `General`

.

**Monte Carlo**

`E`_{b}/N_{0} range

— Range of *E*_{b}/*N*_{0}
values

`1:0.5:5`

(default) | scalar | vector

_{b}/N

_{0}range

Range of
*E*_{b}/*N*_{0}
values over which the BER is evaluated, specified as a scalar or vector.
Units are in dB.

**Example: **`4:2:10`

specifies evaluation of
*E*_{b}/*N*_{0}
over the range [4, 10] at 2 dB increments.

`Simulation environment`

— Simulation environment

**MATLAB** (default) | **Simulink**

Simulation environment, specified as **MATLAB** or
**Simulink**.

`Function name`

— Name of MATLAB function

`viterbisim`

(default)

Name of the MATLAB function for the app to run for the Monte Carlo simulation.

#### Dependencies

To enable this parameter, set **Simulation
environment** to **MATLAB**.

`Model name`

— Name of Simulink model

`commgraycode`

(default)

Name of the Simulink model for the app to run for the Monte Carlo simulation.

#### Dependencies

To enable this parameter, set **Simulation
environment** to **Simulink**.

`BER variable name`

— Name of variable containing BER simulation data

`grayBER`

(default)

Name of the variable containing the BER simulation data. To output the BER
simulation data to the MATLAB workspace, you can assign this variable name as the
**Variable name** parameter value in a To
Workspace block.

**Tip**

Select the To Workspace block from the DSP System Toolbox / Sinks sublibrary. For more information, see To Workspace Block Configuration for Communications System Simulations.

#### Dependencies

To enable this parameter, set the **Simulation
environment** to **Simulink**.

`Number of errors`

— Number of errors to be measured before simulation stops

`100`

(default) | positive integer

Number of errors to be measured before the simulation stops, specified as a positive integer. Typically, to produce an accurate BER estimate,100 measured errors are enough.

`Number of bits`

— Number of bits to be processed before simulation stops

`1e8`

(default) | positive integer

Number of bits to be processed before the simulation stops, specified as a positive integer. This parameter is used to prevent the simulation from running too long.

**Note**

The Monte Carlo simulation stops when either the number of errors or number of bits threshold is reached.

## Tips

You can stop the simulation by clicking

**Stop**on the Monte Carlo Simulation dialog box.

## Version History

**Introduced before R2006a**