# bersync

BER for imperfect synchronization

## Syntax

``ber = bersync(EbNo,timerr,'timing')``
``ber = bersync(EbNo,phaserr,'carrier')``

## Description

The `bersync` function returns the bit error rate (BER) for uncoded coherent BPSK over an additive white Gaussian noise (AWGN) channel for imperfect synchronization. For more information, see Analytical Expressions Used in bersync Function and Bit Error Rate Analysis App.

example

````ber = bersync(EbNo,timerr,'timing')` returns the BER from uncoded coherent binary phase shift keying (BPSK) modulation over an additive white Gaussian noise (AWGN) channel at the specified Eb/N0 with imperfect timing specified by `timerr`. The normalized timing error is assumed to have a Gaussian distribution.```
``` `ber = bersync(EbNo,phaserr,'carrier')` returns the bit error rate (BER) from uncoded BPSK modulation over an AWGN channel at the specified Eb/N0 with a noisy phase reference specified by `phaserr`. The phase error is assumed to have a Gaussian distribution. `phaserr` is the standard deviation of the phase error of the reference carrier phase.```

## Examples

collapse all

Compute the BER for coherent BPSK modulation over an AWGN channel with imperfect timing. Vary the ratio of bit energy to noise power spectral density (${\mathit{E}}_{\mathrm{b}}/{\mathit{N}}_{0}$) and the standard deviation of the timing error. When `timerr` assumes the final value of `0`, the `bersync` function produces the same result as `berawgn(EbNo,'psk',2)`.

```EbNo = [4 8 12]; timerr = [0.2 0.07 0]; ber = zeros(length(timerr),length(EbNo)); for ii = 1:length(timerr) ber(ii,:) = bersync(EbNo,timerr(ii),'timerr'); end```

Display the result using scientific notation.

`format short e; ber`
```ber = 3×3 5.2073e-02 2.0536e-02 1.1160e-02 1.8948e-02 7.9757e-04 4.9008e-06 1.2501e-02 1.9091e-04 9.0060e-09 ```

Switch back to default notation format.

`format;`

## Input Arguments

collapse all

Ratio of bit energy to noise power spectral density ( Eb/N0) in dB, specified as a scalar or vector.

Data Types: `single` | `double`

Standard deviation of the timing error, specified as a scalar in the range [0, 0.5]. Provide the timing error normalized to the symbol interval. The normalized timing error is assumed to have a Gaussian distribution.

Data Types: `double` | `single`

Standard deviation of the phase error for the reference carrier phase in radians, specified as a scalar. The phase error is assumed to have a Gaussian distribution.

Data Types: `double` | `single`

## Output Arguments

collapse all

BER for uncoded coherent BPSK modulation over an AWGN channel returned as a scalar or vector with

The BER is computed for each Eb/N0 setting specified by the input argument `EbNo`.

If `EbNo` is a vector, the output `ber` is a vector of the same size as input `EbNo` and its elements correspond to the different elements of the `EbNo` vector.

Data Types: `double`

## Limitations

In general, the numerical accuracy for the output BER is limited to approximately two significant digits. The numerical accuracy output by this function is limited by:

• Approximations in the analysis leading to the closed-form expressions used by the function

• Approximations related to the numerical implementation of the expressions

Inherent limitations in numerical precision force the function to assume perfect synchronization if the value of `timerr` or `phaserr` is less than the positive distance from the absolute value of the error value to the next larger in magnitude floating point number as determined by the `eps` function. This table indicates how the function behaves under these conditions.

ConditionBehavior of `bersync` Function
`timerr < eps` `bersync(EbNo,timerr,'timing')` is equivalent to `berawgn(EbNo,'psk',2)` with a timing error less than `eps`.
`phaserr < eps``bersync(EbNo,phaserr,'carrier')` is equivalent to `berawgn(EbNo,'psk',2)` with a phase error less than `eps`.

## Algorithms

This function uses formulas from .

When the last input is `'timing'`, the function computes

`$\frac{1}{4\pi \sigma }{\int }_{-\infty }^{\infty }\mathrm{exp}\left(-\frac{{\xi }^{2}}{2{\sigma }^{2}}\right){\int }_{\sqrt{2R}\left(1-2|\xi |\right)}^{\infty }\mathrm{exp}\left(-\frac{{x}^{2}}{2}\right)dxd\xi +\frac{1}{2\sqrt{2\pi }}{\int }_{\sqrt{2R}}^{\infty }\mathrm{exp}\left(-\frac{{x}^{2}}{2}\right)dx$`

σ is the `timerr` input, and R is the value of the `EbNo` input converted from dB to a linear scale.

When the last input is `'carrier'`, the function computes

`$\frac{1}{\pi \sigma }{\int }_{0}^{\infty }\mathrm{exp}\left(-\frac{{\varphi }^{2}}{2{\sigma }^{2}}\right){\int }_{\sqrt{2R}\mathrm{cos}\varphi }^{\infty }\mathrm{exp}\left(-\frac{{y}^{2}}{2}\right)dyd\varphi$`

σ is the `phaserr` input, and R is the value of the `EbNo` input converted from dB to a linear scale.

## Alternatives

You can configure the Theoretical tab in the Bit Error Rate Analysis app to compute theoretical BER values instead of using the `bersync` function.

 Jeruchim, Michel C., Philip Balaban, and K. Sam Shanmugan. Simulation of Communication Systems. Second edition. Boston, MA: Springer US, 2000.

 Sklar, Bernard. Digital Communications: Fundamentals and Applications. 2nd ed. Upper Saddle River, N.J: Prentice-Hall PTR, 2001.

 Stiffler, J. J. Theory of Synchronous Communications. Englewood Cliffs, NJ.: Prentice-Hall, 1971.