# berawgn

BER and SER for uncoded data over AWGN channels

## Syntax

``ber = berawgn(EbNo,modtype,M)``
``ber = berawgn(EbNo,'psk',M,dataenc)``
``ber = berawgn(EbNo,'oqpsk',dataenc)``
``ber = berawgn(EbNo,'fsk',M,coherence)``
``ber = berawgn(EbNo,'fsk',M,coherence,rho)``
``ber = berawgn(EbNo,'msk',precoding)``
``ber = berawgn(EbNo,'msk',precoding,coherence)``
``ber = berawgn(EbNo,'cpfsk',M,modindex,kmin)``
``[ber,ser] = berawgn(___) ``

## Description

The `berawgn` function returns the bit error rate (BER) and symbol error rate (SER) in an additive white Gaussian noise (AWGN) channel for uncoded data using various modulation schemes. The first input argument, `EbNo`, is the ratio of bit energy to noise power spectral density in dB (Eb/N0). Values in the output `ber` and `ser` vectors correspond to the theoretical error rate at the specified Eb/N0 levels for a Gray-coded signal constellation. For more information, see Analytical Expressions Used in berawgn Function and Bit Error Rate Analysis App.

example

````ber = berawgn(EbNo,modtype,M)` returns the BER of uncoded data over an AWGN channel at the specified Eb/N0 levels for the modulation type and modulation order specified by `modtype` and `M`, respectively.```
````ber = berawgn(EbNo,'psk',M,dataenc)` specifies the data encoding type as differential or nondifferential for PSK modulation.```
````ber = berawgn(EbNo,'oqpsk',dataenc)` specifies the data encoding type as differential or nondifferential for OQPSK modulation.```
````ber = berawgn(EbNo,'fsk',M,coherence)` specifies the receiver technique as coherent or noncoherent for FSK modulation.```
````ber = berawgn(EbNo,'fsk',M,coherence,rho)` additionally specifies the complex correlation coefficient of the FSK-modulated signal.```
````ber = berawgn(EbNo,'msk',precoding)` specifies whether precoding is applied for MSK modulation.```
````ber = berawgn(EbNo,'msk',precoding,coherence)` additionally specifies the receiver technique as coherent or noncoherent for MSK modulation.```
````ber = berawgn(EbNo,'cpfsk',M,modindex,kmin)` specifies the modulation index, `modindex`, and the number of paths having the minimum distance, `kmin`, for CPFSK modulation.```
````[ber,ser] = berawgn(___) ` returns the BER and symbol error rate (SER) using any input argument combination from previous syntaxes.```

## Examples

collapse all

Return theoretical bit error rate data for several modulation schemes in an AWGN channel.

Create a vector of ${\mathit{E}}_{\mathrm{b}}/{\mathit{N}}_{0}$ values and specify the modulation order.

```EbNo = (0:10)'; M = 4; % Modulation order```

Return theoretical BER data for QPSK modulation.

`berQ = berawgn(EbNo,'psk',M,'nondiff');`

Return equivalent data for DPSK and FSK modulations.

```berD = berawgn(EbNo,'dpsk',M); berF = berawgn(EbNo,'fsk',M,'coherent');```

Plot the results.

```semilogy(EbNo,[berQ berD berF]) xlabel('Eb/No (dB)') ylabel('BER') legend('QPSK','DPSK','FSK') title("Theoretical Bit Error Rate") grid```

## Input Arguments

collapse all

Energy per bit to noise power spectral density ratio in dB, specified as a scalar or vector.

Data Types: `single` | `double`

Modulation type, specified as one of these options.

`modtype` ValueModulation SchemeDependencies
`'psk'`Phase shift keying (PSK)

When you set the input `dataenc` to `'diff'`, modulation order `M` must be `2` or `4`.

`'oqpsk'`Offset quadrature phase shift keying (OQPSK)None
`'dpsk'`Differential phase shift keying (DPSK) None
`'pam'`Pulse amplitude modulation (PAM) None
`'qam'`Quadrature amplitude modulation (QAM)

The modulation order `M` must be at least 4.

• When k = log2`M` is odd, the symbols lie in a rectangular constellation of size `M` = I × J, where$I={2}^{\frac{k-1}{2}}$ and $J={2}^{\frac{k+1}{2}}$.

• When k is even, the symbols lie in a square constellation of size${2}^{\frac{k}{2}}×{2}^{\frac{k}{2}}$

`'fsk'`Frequency-shift keying (FSK)

When you set the input `coherence` to `'noncoherent'`, modulation order `M` must be in the range [2, 64].

`'msk'`Minimum-shift keying (MSK) None
`'cpfsk'` Continuous-phase frequency-shift keying (CPFSK) None

Data Types: `char` | `string`

Modulation order, specified as an integer equal to 2k, where k is a positive integer.

Example: `4` or `2^2`

Data Types: `single` | `double`

Data encoding type, specified as one of these values.

• `'diff'` — For differential data encoding

• `'nondiff'` — For nondifferential data encoding

#### Dependencies

To enable this argument, set the `modtype` argument to `'psk'` or `'oqpsk'`.

Data Types: `char` | `string`

Coherent detection type, specified as one of these values.

• `'conherent'` — For coherent detection

• `'noncoherent'` — For noncoherent detection

#### Dependencies

To enable this argument, set the `modtype` argument to `'fsk'` or `'msk'`.

Data Types: `char` | `string`

Complex correlation coefficient, specified as a complex scalar. For more information about the complex correlation coefficient and how to compute it for nonorthogonal binary frequency-shift keying (BFSK) modulation, see Nonorthogonal 2-FSK with Coherent Detection.

#### Dependencies

To enable this argument, set the `modtype` argument to `'fsk'` and the `M` argument to `2`.

Data Types: `single` | `double`
Complex Number Support: Yes

Enable precoding, specified as one of these values.

• `'off'` — For conventional MSK

• `'on'` — For precoded MSK

#### Dependencies

To enable this argument, set the `modtype` argument to `'msk'`.

Data Types: `char` | `string`

Modulation index, specified as a positive integer.

#### Dependencies

To enable this argument, set the `modtype` argument to `'cpfsk'`.

Data Types: `single` | `double`

Number of paths having the minimum distance, specified as a positive integer. If the number of paths is unknown, specify a value of 1.

#### Dependencies

To enable this argument, set the `modtype` argument to `'cpfsk'`.

Data Types: `single` | `double`

## Output Arguments

collapse all

Bit error rate (BER) for uncoded data over an AWGN channel, returned as a scalar or vector. The BER is computed for each Eb/N0 setting specified by input `EbNo` according to the modulation type specified by input `modtype` and related dependencies.

Data Types: `double`

Symbol error rate (SER) for uncoded data over an AWGN channel, returned as a scalar or vector. The SER is computed for each Eb/N0 setting specified by input `EbNo` according to the modulation type specified by input `modtype` and related dependencies.

Data Types: `double`

## Limitations

The numerical accuracy of the output returned by this function is limited by approximations related to the numerical implementation of the expressions to roughly two significant digits.

## Alternatives

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

## References

[1] Anderson, John B., Tor Aulin, and Carl-Erik Sundberg. Digital Phase Modulation. New York: Plenum Press, 1986.

[2] Cho, K., and D. Yoon. "On the General BER Expression of One- and Two-Dimensional Amplitude Modulations." IEEE Trans. Commun. 50, no. 7, (2002): 1074-1080.

[3] Lee, P. J. "Computation of the Bit Error Rate of Coherent M-ary PSK with Gray Code Bit Mapping." IEEE Trans. Commun. COM-34, no. 5, (1986): 488-491.

[4] Proakis, John G. Digital Communications. 5th ed. New York: McGraw Hill, 2007.

[5] Simon, M. K, S. M. Hinedi, and W. C. Lindsey. Digital Communication Techniques – Signal Design and Detection. Prentice-Hall, 1995.

[6] Simon, M. K. "On the Bit-Error Probability of Differentially Encoded QPSK and Offset QPSK in the Presence of Carrier Synchronization." IEEE Trans. Commun. 54, (2006): 806-812.

[7] Lindsey, W. C., and M. K. Simon. Telecommunication Systems Engineering. Englewood Cliffs, N.J: Prentice-Hall, 1973.

## Version History

Introduced before R2006a