This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

comm.MER System object

Package: comm

Measure modulation error ratio


The comm.MER (modulation error ratio) object measures the signal-to-noise ratio (SNR) in digital modulation applications. You can use MER measurements to determine system performance in communications applications. For example, determining whether a DVB-T system conforms to applicable radio transmission standards requires accurate MER measurements. The block measures all outputs in dB.

To measure modulation error ratio:

  1. Define and set up your MER object. See Construction.

  2. Call step to measure the modulation error ratio according to the properties of comm.MER. The behavior of step is specific to each object in the toolbox.

    Note:   Starting in R2016b, instead of using the step method to perform the operation defined by the System object™, you can call the object with arguments, as if it were a function. For example, y = step(obj,x) and y = obj(x) perform equivalent operations.


MER = comm.MER creates a modulation error ratio (MER) System object, MER. This object measures the signal-to-noise ratio (SNR) in digital modulation applications.

MER = comm.MER(Name,Value) creates an MER object with each specified property set to the specified value. You can specify additional name-value pair arguments in any order as (Name1,Value1,...,NameN,ValueN).

Example: MER = comm.MER('ReferenceSignalSource','Estimated from reference constellation') creates an object, MER, that measures the MER of a received signal by using a reference constellation.



Reference signal source

Reference signal source, specified as either 'Input port' (default) or 'Estimated from reference constellation'. To provide an explicit reference signal against which the input signal is measured, set this property to 'Input port'. To measure the MER of the input signal against a reference constellation, set this property to 'Estimated from reference constellation'.


Reference constellation

Reference constellation, specified as a vector. This property is available when the ReferenceSignalSource property is 'Estimated from reference constellation'.

The default is [0.7071 - 0.7071i; -0.7071 - 0.7071i; -0.7071 + 0.7071i; 0.7071 + 0.7071i], which corresponds to a standard QPSK constellation. You can derive constellation points by using modulation functions or objects. For example, to derive the reference constellation for a 16-QAM signal, you can use qammod(0:15,16).


Measurement interval source

Measurement interval source, specified as one of the following: 'Input length' (default), 'Entire history', 'Custom', or 'Custom with periodic reset'. This property affects the RMS and maximum MER outputs only.

  • To calculate MER using only the current samples, set this property to 'Input length'.

  • To calculate MER for all samples, set this property to 'Entire history'.

  • To calculate MER over an interval you specify and to use a sliding window, set this property to 'Custom'.

  • To calculate MER over an interval you specify and to reset the object each time the measurement interval is filled, set this property to 'Custom with periodic reset'.


Measurement interval

Measurement interval over which the MER is calculated, specified in samples as a real positive integer. This property is available when MeasurementIntervalSource is 'Custom' or 'Custom with periodic reset'. The default is 100.


Averaging dimensions

Averaging dimensions, specified as a positive integer or row vector of positive integers. This property determines the dimensions over which the averaging is performed. For example, to average across the rows, set this property to 2. The default is 1.

The object supports variable-size inputs over the dimensions in which the averaging takes place. However, the input size for the nonaveraged dimensions must remain constant between step calls. For example, if the input has size [4 3 2] and Averaging dimensions is [1 3], the output size is [1 3 1], and the second dimension must remain fixed at 3.


Minimum MER measurement output port

Minimum MER measurement output port, specified as a logical scalar. To create an output port for minimum MER measurements, set this property to true. The default is false.


X-percentile MER measurement output port

X-percentile MER measurement output port, specified as a logical scalar. To create an output port for X-percentile MER measurements, set this property to true. The X-percentile MER measurements persist until you reset the object. These measurements are calculated by using all of the input frames since the last reset. The default is false.


X-percentile value

X-percentile value above which X% of the MER measurements fall, specified as a real scalar from 0 to 100. This property applies when XPercentileMEROutputPort is true. The default is 95.


Symbol count output port

Symbol count output port, specified as a logical scalar. To output the number of accumulated symbols used to calculate the X-percentile MER measurements, set this property to true. This property is available when XPercentileMEROutputPort property is true. The default is false.


cloneCreate MER measurement object with same property values
getNumInputsNumber of expected inputs to step method
getNumOutputsNumber of outputs from step method
isLockedLocked status for input attributes and nontunable properties
releaseAllow property value and input characteristics changes
resetReset states of MER measurement object
stepMeasure modulation error ratio


expand all

Create an MER object which outputs minimum MER, 90-percentile MER, and the number of symbols.

mer = comm.MER('MinimumMEROutputPort',true, ...

Generate random data. Apply 16-QAM modulation having unit average power. 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 RMS, minimum, and 90th percentile MER values.

[MERdB,MinMER,PercentileMER,NumSym] = mer(refsym,rxsym)


MinMER =


PercentileMER =


NumSym =


Generate random data symbols, and apply 8-PSK modulation.

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

Pass the modulated signal through an AWGN channel.

rxSig = awgn(txSig,30);

Create an MER object. Measure the MER using the transmitted signal as the reference.

mer = comm.MER;
mer1 = mer(txSig,rxSig);

Release the MER object. Set 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 it matches the result obtained with a reference signal.

mer2 = mer(rxSig);
[mer1 mer2]
ans =

   30.0271   30.0271

Measure the MER of a noisy 8-PSK signal using two types of custom measurement intervals. Display the results.

Set the number of frames, M, and the number of subframes per frame, K.

M = 2;
K = 5;

Set the number of symbols in a subframe. Calculate the corresponding frame length.

sfLen = 100;
frmLen = K*sfLen
frmLen =


Create an MER object. Configure the object to use a custom measurement interval equal to the frame length.

mer1 = comm.MER('MeasurementIntervalSource','Custom', ...

Configure the object to measure MER using an 8-PSK reference constellation.

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

Create an MER object, and configure it use a 500-symbol measurement interval with a periodic reset. Configure the object to measure MER using an 8-PSK reference constellation.

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

Initialize the MER and signal-to-noise arrays.

merNoReset = zeros(K,M);
merReset = zeros(K,M);
snrdB = zeros(K,M);

Measure the MER for a noisy 8-PSK signal using both objects. The SNR is increases by 1 dB from subframe to subframe. For merNoReset, the 500 most recent symbols are used to compute the estimate. In this case, a sliding window is used so that an entire data frame is used as the basis for the estimate. For merReset, the symbols are cleared each time a new frame is encountered.

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

Display the MER measured using the two 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')

Create OFDM modulator and demodulator objects.

ofdmmod = comm.OFDMModulator('FFTLength',32,'NumSymbols',4);
ofdmdemod = comm.OFDMDemodulator('FFTLength',32,'NumSymbols',4);

Determine the number of subcarriers and symbols in the OFDM signal.

ofdmDims = info(ofdmmod);
numSC = ofdmDims.DataInputSize(1)
numSym = ofdmDims.DataInputSize(2)
numSC =


numSym =


Generate random symbols and apply QPSK modulation.

msg = randi([0 3],numSC,numSym);
modSig = pskmod(msg,4,pi/4);

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

txSig = ofdmmod(modSig);
rxSig = awgn(txSig,10,'measured');
demodSig = ofdmdemod(rxSig);

Create an MER object, where the result is averaged over the subcarriers. Measure the MER. There are four entries corresponding to each of the 4 OFDM symbols.

mer = comm.MER('AveragingDimensions',1);
modErrorRatio = mer(demodSig,modSig)
modErrorRatio =

   11.2338   12.5315   12.8882   12.7015

Overwrite the MER object, where the result is averaged over the OFDM symbols. Measure the MER. There are 21 entries corresponding to each of the 21 subcarriers.

mer = comm.MER('AveragingDimensions',2);
modErrorRatio = mer(demodSig,modSig)
modErrorRatio =


Measure the MER and average over both the subcarriers and the OFDM symbols.

mer = comm.MER('AveragingDimensions',[1 2]);
modErrorRatio = mer(demodSig,modSig)
modErrorRatio =



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


The MER for the kth symbol is


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



  • ek = (IkIk~)2+(QkQ~k)2

  • Ik = In-phase measurement of the kth symbol in the burst

  • Qk = Quadrature phase measurement of the kth symbol in the burst

  • Ik and Qk represent ideal (reference) values. I~k and Q~k represent measured (received) symbols.

The block 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.

Introduced in R2012a

Was this topic helpful?