Main Content

comm.MER

Measure modulation error ratio of received signal

Description

The comm.MER System object™ computes a form of signal-to-noise ratio (SNR) measurement that you can use to assess the ability of a receiver to accurately demodulate a signal. Specifically, it returns the modulation error ratio (MER), minimum MER, and percentile MER for a received signal. You use the MER measurements to determine system performance in communications applications. For example, to determine compliance with applicable DVB-T system radio transmission standards conformance testing requires accurate MER measurements.

To measure the MER of a received signal:

  1. Create the comm.MER object and set its properties.

  2. Call the object with arguments, as if it were a function.

To learn more about how System objects work, see What Are System Objects?

Creation

Description

mer1 = comm.MER creates an MER System object with default property values.

example

mer1 = comm.MER(Name=Value) sets properties using one or more name-value arguments. For example, comm.MER(ReferenceSignalSource="Estimated from reference constellation") configures the object to measure the MER of a received signal relative to a reference constellation.

example

Properties

expand all

Unless otherwise indicated, properties are nontunable, which means you cannot change their values after calling the object. Objects lock when you call them, and the release function unlocks them.

If a property is tunable, you can change its value at any time.

For more information on changing property values, see System Design in MATLAB Using System Objects.

Reference signal source, specified as 'Input port' or 'Estimated from reference constellation'.

  • To specify the reference signal with the refSym input , set this property to 'Input port'.

  • To specify the reference signal with the ReferenceConstellation property, set this property to 'Estimated from reference constellation'.

Reference constellation, specified as a vector. The default value corresponds to a quadrature phase-shift keying (QPSK) constellation with unit average power. You can derive constellation points by using modulation functions or objects.

Example: To define the reference constellation as a 16-QAM signal scaled so that the QAM constellation points are separated by a minimum distance of two, set this property to qammod(0:15,16)

Dependencies

To enable this property, set the ReferenceSignalSource property to 'Estimated from reference constellation'.

Data Types: double
Complex Number Support: Yes

Measurement interval source for MER and minimum MER measurements, specified as one of these values.

  • 'Input length' — Measure MER using only the current samples.

  • 'Entire history' — Measure MER for all samples.

  • 'Custom' — Measure the MER by using a sliding window over an interval that you specify.

  • 'Custom with periodic reset' — Measure the MER over an interval that you specify and reset the block after measuring over each interval.

This property affects only the MER and minimum MER outputs.

Measurement interval, specified as a positive integer.

Dependencies

To enable this property, set the MeasurementIntervalSource property to 'Custom' or 'Custom with periodic reset'.

Data Types: double

Averaging dimensions over which the object averages the MER measurements, specified as a vector of integers in the range [1, 3]. For example, to average across the columns, set this property to 2.

This object supports variable-size inputs of the dimensions across which the averaging takes place. However, the input size for the nonaveraged dimensions must remain constant between calls to the object. For example, if the input has size [1000 3 2] and you set this property to [1 3], the output size is [1 3 1], and the number of elements in the second dimension must remain fixed at 3.

Data Types: double

Option to return minimum MER measurements, specified as a logical 1 (true) or 0 (false).

Data Types: logical

Option to return X-percentile MER measurements, specified as a logical 1 (true) or 0 (false). Specify the value of X in the XPercentileValue property. When you set this property to 1 (true), X-percentile MER measurements persist until you reset the object. The object performs these measurements by using all of the input frames since the last reset.

Data Types: logical

Value below which X% of MER measurements fall, specified as a scalar in the range [0, 100].

Dependencies

To enable this property, set the XPercentileMEROutputPort property to true.

Data Types: double

Option to return the number of accumulated symbols that the object uses to measure the X-percentile MER since the last reset, specified as a logical 1 (true) or 0 (false).

Dependencies

To enable this property, set the XPercentileMEROutputPort property to true.

Data Types: logical

Usage

Description

merdb = mer1(refSym,rxSym) returns the MER of received signal rxSym relative to reference signal refSym over the measurement interval specified in the MeasurementIntervalSource and MeasurementInterval properties.

example

[merdb,minMER] = mer1(refSym,rxSym) also returns the minimum percentage MER over the configured measurement interval.

To use this syntax, set the MinimumMEROutputPort property to true.

[___,pMER] = mer1(refSym,rxSym) also returns the value below which X% of MER measurements fall using all input frames since the last reset, regardless of measurement interval configuration. Set the value of X in the XPercentileValue property. For example, if you set the XPercentileValue to 95, then 95% of all MER measurements since the last reset fall below the value of pMER.

To use this syntax, set the XPercentileMEROutputPort property to true.

[___,pMER,numSym] = mer1(refSym,rxSym) also returns the number of symbols used to measure MER. To use this syntax, set the XPercentileMEROutputPort and SymbolCountOutputPort to true.

example

[___] = mer1(rxSym) measures the MER of the received signal relative to the reference signal specified in the ReferenceConstellation property. You can use this syntax with any previous output argument combination.

To use this syntax, set the ReferenceSignalSource property to "Estimated from reference constellation".

example

Input Arguments

expand all

Reference signal, specified as a scalar, vector, matrix, or 3-D array. If you specify this input, the object measures the MER of the rxSym input by using this input as a reference constellation. The dimensions of this input must match those of the rxSym input. The object uses each element of this input as the reference symbol for the corresponding element of the rxSym input.

This object accepts variable-size inputs. After the object is locked, you can change the size of each input channel, but you cannot change the number of channels. For more information, see Variable-Size Signal Support with System Objects.

Data Types: single | double | int8 | int16 | int32 | int64 | fi
Complex Number Support: Yes

Received signal, specified as a scalar, vector, matrix, or 3-D array.

Data Types: single | double | int8 | int16 | int32 | int64 | fi
Complex Number Support: Yes

Output Arguments

expand all

Percentage MER of the received signal over the configured measurement interval, returned as a scalar in units of decibels.

Data Types: double

Minimum percentage MER over the configured measurement interval, returned as a scalar in units of decibels.

Data Types: double

Value below which X% of MER measurements fall since the last reset, returned as a scalar in units of decibels. Set the value of X in the XPercentileValue property.

Data Types: double

Number of symbols that the object uses to measure the pMER output, returned as a positive integer.

Data Types: double

Object Functions

To use an object function, specify the System object as the first input argument. For example, to release system resources of a System object named obj, use this syntax:

release(obj)

expand all

stepRun System object algorithm
releaseRelease resources and allow changes to System object property values and input characteristics
resetReset internal states of System object

Examples

collapse all

Generate random data symbols and apply 8-PSK modulation.

d = randi([0 7],2000,1);
refSym = pskmod(d,8,pi/8);

Pass the modulated signal through an AWGN channel.

rxSym = awgn(refSym,30);

Create an MER object with default property values.

mer = comm.MER;

Measure the MER using the transmitted signal as the reference.

rmsMER1 = mer(refSym,rxSym);

Release the MER object.

release(mer)

Configure the object to use a reference constellation for making MER measurements.

mer.ReferenceSignalSource = "Estimated from reference constellation";
mer.ReferenceConstellation = pskmod(0:7,8,pi/8);

Measure the MER using only the received signal as an input. Verify that the two MER measurements match.

rmsMER2 = mer(rxSym);
[rmsMER1 rmsMER2]
ans = 1×2

   30.0271   30.0271

Specify the FFT length, number of subcarriers, number of symbols, and cyclic prefix length.

nfft = 32;  % Number of subcarriers
nSym = 4;   % Number of OFDM symbols
cplen = 16; % Cyclic prefix length

Generate a random signal and apply QPSK modulation.

msg = randi([0 3],nfft,nSym);
refSym = pskmod(msg,4,pi/4);

OFDM modulate the QPSK symbols. Pass the signal through an AWGN channel. OFDM demodulate the noisy signal.

txSig = ofdmmod(refSym,nfft,cplen);
rxSig = awgn(txSig,10,"measured");
rxSym = ofdmdemod(rxSig,nfft,cplen);

Configure an MER object to measure the average MER across the subcarriers. Averaging across the rows returns MER measurements corresponding to each of the OFDM symbols.

mer = comm.MER(AveragingDimensions=1);
merdB = mer(refSym,rxSym)
merdB = 1×4

   10.6693    9.1480   10.5967   10.8326

Configure the MER object to measure the MER over the OFDM symbols. Averaging across the columns returns MER measurements corresponding to each of the subcarriers.

mer = comm.MER(AveragingDimensions=2);
merdB = mer(refSym,rxSym)
merdB = 32×1

   13.7684
   14.9146
   12.9240
    8.1226
   10.7215
   11.1325
   10.6458
   12.4529
   10.6279
   11.0184
      ⋮

Averaging across the rows and columns returns one MER measurement for all the subcarriers and OFDM symbols.

mer = comm.MER(AveragingDimensions=[1 2]);
merdB = mer(refSym,rxSym)
merdB = 
10.2559

Create an MER object to measure MER, minimum MER, 90-percentile MER, and the number of symbols.

mer = comm.MER(MinimumMEROutputPort=true, ...
    XPercentileMEROutputPort=true,XPercentileValue=90, ...
    SymbolCountOutputPort=true);

Generate random data, apply 16-QAM with unit average power, and pass the signal through an AWGN channel.

data = randi([0 15],1000,1);
refsym = qammod(data,16,UnitAveragePower=true);
rxsym = awgn(refsym,20);

Determine the MER, minimum MER, and 90th percentile MER values.

[MERdB,MinMER,pMER,nSym] = mer(refsym,rxsym)
MERdB = 
20.1071
MinMER = 
9.2913
pMER = 
16.4700
nSym = 
1000

Measure the MER of a noisy 8-PSK signal using two types of custom measurement interval and display the results.

Define variables for the simulation.

nframe = 2;              % Number of frames
nsubframe = 5;           % Number of subframes per frame
spsf = 100;              % Number of symbols per subframe
frmLen = nsubframe*spsf; % Frame length

Configure an MER object to use a custom measurement interval equal to the frame length and measure MER using an 8-PSK reference constellation.

mer1 = comm.MER( ...
    MeasurementIntervalSource="Custom", ...
    MeasurementInterval=frmLen, ...
    ReferenceSignalSource="Estimated from reference constellation", ...
    ReferenceConstellation=pskmod(0:7,8,pi/8));

Configure another MER object that uses a 500-symbol measurement interval with a periodic reset and measures MER using the same 8-PSK reference constellation.

mer2 = comm.MER( ...
    MeasurementIntervalSource="Custom with periodic reset", ...
    MeasurementInterval=frmLen, ...
    ReferenceSignalSource="Estimated from reference constellation", ...
    ReferenceConstellation=pskmod(0:7,8,pi/8));

Initialize the MER and signal-to-noise arrays.

merNoReset = zeros(nsubframe,nframe);
merReset = zeros(nsubframe,nframe);
snrdB = zeros(nsubframe,nframe);

Measure the MER for a noisy 8-PSK signal using both objects. The SNR increases by 1 dB from subframe to subframe. The merNoReset object uses the 500 most recent symbols to compute the estimate. This object uses a sliding window so that an entire data frame is the basis for the estimate. The merReset object clears the symbols each time it encounters a new frame.

for m = 1:nframe
    for k = 1:nsubframe
        data = randi([0 7],spsf,1);
        txSig = pskmod(data,8,pi/8);
        snrdB(k,m) = k+(m-1)*nsubframe+7;
        rxSig = awgn(txSig,snrdB(k,m));
        merNoReset(k,m) = mer1(rxSig);
        merReset(k,m) = mer2(rxSig);
    end
end

Display the MER measured using both approaches. The windowing used in the first case provides an averaging across the subframes. In the second case, the MER object resets after the first frame so that the calculated MER values more accurately reflect the current SNR.

stairs(snrdB(:),[merNoReset(:) merReset(:)])
xlabel("SNR (dB)")
ylabel("MER (%)")
legend("No reset","Periodic reset")

Figure contains an axes object. The axes object with xlabel SNR (dB), ylabel MER (%) contains 2 objects of type stair. These objects represent No reset, Periodic reset.

Algorithms

MER is a measure of the SNR in a modulated signal calculated in dB. The MER over a burst containing N symbols is

MER=10×log10(k=1N(Ik2+Qk2)k=1N(ek))dB,

where:

  • ek = ek=(IkI˜k)2+(QkQ˜k)2.

  • Ik represents the in-phase component of the kth symbol in the burst.

  • Qk represents the quadrature phase component of the kth symbol in the burst.

  • Ik and Qk represent ideal reference values.

  • I˜k and Q˜k represent received symbols.

  • N represents the number of symbols in the burst.

The MER for the kth symbol is

MERk=10×log10(1Nk=1N(Ik2+Qk2)ek)dB.

The minimum MER represents the minimum MER value in a burst, or

MERmin=mink[1,...,N]{MERk},

The algorithm computes the X-percentile MER by creating a histogram of all the incoming MERk values. The output provides the MER value above which X% of the MER values fall.

References

[1] ESTI TR 101 290. "Digital Video Broadcasting (DVB): Measurement guidelines for DVB systems." June 2020.

Extended Capabilities

Version History

Introduced in R2012a