# berconfint

Error probability estimate and confidence interval of Monte Carlo simulation

## Syntax

``[errprobest,interval] = berconfint(nerrs,ntrials)``
``[errprobest,interval] = berconfint(nerrs,ntrials,level)``

## Description

````[errprobest,interval] = berconfint(nerrs,ntrials)` returns the error probability estimate and 95% confidence interval for a Monte Carlo simulation of `ntrials` trials with `nerrs` errors.```

example

````[errprobest,interval] = berconfint(nerrs,ntrials,level)` specifies the confidence level.```

## Examples

collapse all

Compute the confidence interval for the simulation of a communication system that has 100 bit errors in 106 trials. The bit error rate (BER) for that simulation is ${10}^{-4}$.

Compute the 90% confidence interval for the BER of the system. The output shows that, with 90% confidence level, the BER for the system is between 0.0000841 and 0.0001181.

```nerrs = 100; % Number of bit errors in simulation ntrials = 10^6; % Number of trials in simulation level = 0.90; % Confidence level [ber,interval] = berconfint(nerrs,ntrials,level)```
```ber = 1.0000e-04 ```
```interval = 1×2 10-3 × 0.0841 0.1181 ```

For an example that uses the output of the `berconfint` function to plot error bars on a BER plot, see Use Curve Fitting on Error Rate Plot.

## Input Arguments

collapse all

Number of errors from Monte Carlo simulation results, specified as a scalar.

Data Types: `single` | `double`

Number of trials from Monte Carlo simulation results, specified as a scalar.

Data Types: `single` | `double`

Confidence level for a Monte Carlo simulation, specified as a scalar in the range [0, 1].

Data Types: `single` | `double`

## Output Arguments

collapse all

Error probability estimate for a Monte Carlo simulation, returned as a scalar.

• If the errors and trials are measured in bits, the error probability is the bit error rate (BER).

• If the errors and trials are measured in symbols, the error probability is the symbol error rate (SER).

Confidence interval for a Monte Carlo simulation, returned as a two-element column vector that lists the endpoints of the confidence interval for the confidence level specified by the input `level`.

## References

[1] Jeruchim, Michel C., Philip Balaban, and K. Sam Shanmugan. Simulation of Communication Systems. Second Edition. New York: Kluwer Academic/Plenum, 2000.

## Version History

Introduced before R2006a