Main Content


BER using semianalytic technique


The semianalytic function computes the bit error rate (BER) of a communication system for the specified energy per bit to noise power spectral density ratio (Eb/N0) levels by using the semianalytic technique. The system transmits complex baseband signal txsig and receives noiseless complex baseband signal rxsig. The function filters the received signal rxsig and determines the symbol error probability of each received IQ symbol by analytically applying a Gaussian noise distribution to each complex value. The function averages the error probabilities over the entire received signal to determine the overall error probability. For each symbol error probability, the function returns a BER, assuming a Gray-coded constellation. For more information, see When to Use Semianalytic Technique.

ber = semianalytic(txsig,rxsig,modtype,M,Nsamp) returns the BER of the system for the transmitted signal txsig, received noiseless signal rxsig, modulation type modtype, and modulation order M. The function uses an ideal integrator to filter rxsig. Input Nsamp is the number of samples per symbol for each signal. The returned BER values correspond to the default Eb/N0 levels in the range [0, 20] in dB.

ber = semianalytic(txsig,rxsig,modtype,M,Nsamp,num,den) specifies the filter coefficients of the receiver filter in descending polynomial powers by numerator num and denominator den. The function uses the specified receiver filter instead of an ideal integrator to filter rxsig.


ber = semianalytic(___,EbNo) specifies the Eb/N0 levels in addition to any of the input argument combinations in the previous syntaxes. The returned BER values correspond to the specified Eb/N0 levels.

[ber,avgampl,avgpower] = semianalytic(___) returns the mean signal amplitude and the mean power of the received signal after filtering and sampling the signal at the symbol rate.


collapse all

Use the semianalytic technique for BER analysis using a 16-QAM modulated signal. Compare the error rates obtained from the semianalytic technique with the theoretical error rates obtained from published formulas and computed using the berawgn function.

Generate a message signal. To obtain accurate results, the signal must be at least ML long. M is the modulation order of the signal, and L is the length of the channel impulse response.

M = 16;          % Alphabet size of modulation
L = 1;           % Length of impulse response of channel
msg = [0:M-1 0]; % M-ary message sequence of length greater than M^L

Modulate the message signal using baseband modulation.

modsig = qammod(msg',M);          % Modulate data
Nsamp = 16;
modsig = rectpulse(modsig,Nsamp); % Rectangular pulse shaping

Apply a transmitter filter.

txsig = modsig;  % No filter in this example

Pass txsig through a noiseless channel, applying a static phase offset of 1 degree.

rxsig = txsig*exp(1i*pi/180);

Specify the receiver filter as a pair of input arguments. In this case, num and den represent an ideal integrator.

num = ones(Nsamp,1)/Nsamp;
den = 1;
EbNo = 0:20;
ber = semianalytic(txsig,rxsig,'qam',M,Nsamp,num,den,EbNo);

For comparison, calculate theoretical BER.

bertheory = berawgn(EbNo,'qam',M);

Plot the computed BER and theoretical BER. The differences between the theoretical and semianalytic error rates are due to the phase offset added to the 16-QAM signal.

hold on; semilogy(EbNo,bertheory,'ro');
title('Semianalytic BER Versus Theoretical BER');
xlabel('E_b/N_o (dB)');
legend('Semianalytic BER with phase offset',...
    'Theoretical BER without phase offset','Location','SouthWest');
hold off;
grid on;

Figure contains an axes object. The axes object with title Semianalytic BER Versus Theoretical BER, xlabel E indexOf b/N o baseline blank (dB) contains 2 objects of type line. One or more of the lines displays its values using only markers These objects represent Semianalytic BER with phase offset, Theoretical BER without phase offset.

Input Arguments

collapse all

Transmitted baseband signal, specified as a complex vector. txsig must contain at least ML symbols. M is the modulation order of the signal and L is the length of the channel impulse response in symbols. For more information on how to generate a transmitted baseband signal to use in this function, see Procedure for Using Semianalytic Technique.

Data Types: double
Complex Number Support: Yes

Received noiseless baseband signal, specified as a complex vector.

Data Types: double
Complex Number Support: Yes

Modulation type, specified as one of these options in this table.

modtype ValueModulation SchemeValid Values of Input M
'dpsk' Differential phase shift keying (DPSK) 2 or 4
'msk/diff' Minimum shift keying (MSK) with differential encoding, which is equivalent to conventional MSK2
'msk/nondiff' Minimum shift keying (MSK) with nondifferential encoding, which is equivalent to precoded MSK2
'psk/diff' Phase shift keying (PSK) with differential encoding2 or 4
'psk/nondiff' Phase shift keying (PSK) with nondifferential encoding2, 4, 8, 16, 32, or 64
'oqpsk' Offset quadrature phase shift keying (OQPSK) 4
'qam' Quadrature amplitude modulation (QAM) 4, 8, 16, 32, 64, 128, 256, 512, or 1024

Data Types: char | string

Modulation order, specified as a power of two. Valid modulation order values depend on the specified modulation type, as described in the modtype input.

Data Types: single | double

Number of samples per symbol of received and transmitted signals, specified as a positive integer.

Data Types: double

Numerator coefficients of the receiver filter in descending polynomial powers, specified as a numeric row vector. If you do not specify this input, the function sets num to a default value to model an ideal integrator. The function bases the default value on the modtype input, as this table shows.

modtype ValueDefault num Value
'dpsk', 'psk/diff', 'psk/nondiff', or 'qam' ones(Nsamp,1)/Nsamp
'oqpsk', 'msk/diff', or 'msk/nondiff'ones(2*Nsamp,1)/(2*Nsamp)

Data Types: double

Denominator coefficients of the receiver filter in descending polynomial powers, specified as a numeric row vector. The default value corresponds to an ideal integrator.

Data Types: double

Eb/N0 levels in dB, specified as a numeric scalar or numeric vector.

Data Types: single | double

Output Arguments

collapse all

BER, returned as a numeric scalar or numeric vector. The function computes the BER for the Eb/N0 levels that you specify for the EbNo input. If EbNo is a vector, then the output ber is a vector of the size of EbNo and consists of elements corresponding to the different Eb/N0 levels.


The output ber is an upper bound on the BER for these modulation schemes.

  • DQPSK (that is, if you set input modtype to 'dpsk' and input M to 4)

  • Cross QAM (that is, if you set input modtype to 'qam' and input M to a value that is not a perfect square). In this case, the upper bound is slightly tighter than the upper bound used for the cross QAM case of the berawgn function.

Data Types: double

Mean signal amplitude of the I and Q components of the received signal after filtering and decimating the signal to the symbol rate, returned as a complex number.

Data Types: double
Complex Number Support: Yes

Mean power of the received signal after filtering and sampling the signal at the symbol rate, returned as a numeric scalar.

Data Types: double


The semianalytic function makes several assumptions about the communication system. To find out whether your communication system is suitable for the semianalytic technique and the semianalytic function, see When to Use Semianalytic Technique.

More About

collapse all

When to Use Semianalytic Technique

The Monte-Carlo simulation described in the Performance Results via Simulation section effectively calculates the BER for a variety of communication systems but can be prohibitively time-consuming for small error rates (for example, error rates of 10-6 or less). The semianalytic technique is an alternative way to compute error rates. This technique can produce results faster than a nonanalytic method that uses only simulated data.

To apply the semianalytic technique, the communication system must satisfy these characteristics.

  • Any effects of multipath fading, quantization, and amplifier nonlinearities must precede the effects of noise in the modeled channel.

  • The receiver is perfectly synchronized with the carrier, and timing jitter is negligible. Because phase noise and timing jitter can be slow processes, they can reduce the applicability of the semianalytic technique to a communication system.

  • The noiseless simulation has no errors in the received signal constellation. Distortions from sources other than noise must be mild enough to keep each signal point in its correct decision region. For instance, if the modeled system has a phase rotation that places the received signal points outside of their proper decision regions, then the semianalytic technique is not suitable to predict system performance.

If the communication system does not satisfy these characteristics, the calculated BER can be lower than expected. The semianalytic function assumes that the noise in the modeled channel is Gaussian. For details on how to adapt the semianalytic technique for non-Gaussian noise, see the discussion of generalized exponential distributions in [1].

Procedure for Using Semianalytic Technique

These steps describe how to implement the semianalytic technique by using the semianalytic function.

  1. Generate a message signal containing at least ML symbols. M is the modulation order, and L is the length of the impulse response of the channel in symbols. Start with an augmented binary pseudonoise (PN) sequence of length (log2M)ML. An augmented PN sequence is a PN sequence with an extra zero appended to it, which makes the distribution of ones and zeros equal.

  2. Modulate a carrier with the message signal by using one of the baseband modulation types that semianalytic supports. For an overview, see the modtype input. Shape the resultant signal with rectangular pulse shaping, using an oversampling factor that you use later for filtering the modulated signal. Use the result of this step as txsig when you call the semianalytic function.

  3. Filter the modulated signal with a transmit filter. This filter is often a square-root raised cosine filter, but you can also use a Butterworth, Bessel, Chebyshev type 1 or 2, elliptic, or more general FIR or IIR filter. If you use a square-root raised cosine filter, use the filter on the nonoversampled modulated signal, and specify the oversampling factor in the filtering function. You can apply the other filters to the rectangularly pulse shaped signal.

  4. Pass the filtered signal through a noiseless channel. This channel can include multipath fading effects, phase shifts, amplifier nonlinearities, quantization, and additional filtering, but it must not include noise. Use the result of this step as the rxsig input when you call the semianalytic function.

  5. Call the semianalytic function, specifying the transmitted and received signals, txsig and rxsig, obtained in the previous steps. Optionally, you can specify a custom receiver filter by using the num and den inputs or custom Eb/N0 levels by using the EbNo input.


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

[2] Pasupathy, S., "Minimum Shift Keying: A Spectrally Efficient Modulation". IEEE Communications Magazine, July, 1979, pp. 14–22.

Version History

Introduced before R2006a