Main Content

comm.GMSKDemodulator

Demodulate GMSK-modulated signal

Description

The comm.GMSKDemodulator System object™ uses a Viterbi algorithm or maximum logarithmic a posteriori probability (max-log-MAP) algorithm to demodulate a signal that was modulated using the Gaussian minimum shift keying (GMSK) method. The input is a baseband representation of the modulated signal.

To demodulate a GMSK-modulated signal:

  1. Create the comm.GMSKDemodulator 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

gmskdemodulator = comm.GMSKDemodulator creates a demodulator System object that demodulates the input GMSK-modulated data by using the Viterbi algorithm or the max-log MAP algorithm. For more information, see Algorithms.

example

gmskdemodulator = comm.GMSKDemodulator(Name,Value) sets properties using one or more name-value pairs. For example, comm.GMSKDemodulator(PulseLength=6) specifies the length of the Gaussian pulse shape as 6 symbol intervals.

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.

Option to output data as bits, specified as a numeric or logical 0 (false) or 1 (true). When you run the object, the output is a 1-by-(N / SamplesPerSymbol) column vector. N is the length of the input signal, X, which is the number of input baseband modulated symbols.

  • When you set this property to false, the values output are -1 or 1.

  • When you set this property to true, the values that are output depend on the DecisionMethod property setting.

Data Types: logical

Demodulation decision method, specified as 'Hard decision' or 'Approximate log-likelihood ratio'.

  • When you set this property to 'Hard decision', the output, Y, is returned as a column vector with element values of 0 or 1. The output data type is specified by OutputDataType.

  • When you set this property to 'Approximate log-likelihood ratio', the output data type is the same as the input, X. For the approximate log-likelihood ratio, the object generates positive values for 0s and negative values for 1s.

For more information, see Algorithms.

Dependencies

This property applies when you set BitOutput to true.

Source of noise variance, specified as 'Property' or 'Input port'.

  • When you set this property to 'Property', you set the noise variance by using the Variance property.

  • When you set this property to 'Input port', you set the noise variance by using the nvar input argument.

Dependencies

This property applies when you set DecisionMethod to 'Approximate log-likelihood ratio'.

Noise variance, specified as a positive scalar value.

Tunable: Yes

Dependencies

This property applies when you set VarianceSource to 'Property' and DecisionMethod to 'Approximate log-likelihood ratio'.

Data Types: double

Product of the bandwidth and symbol time for the Gaussian pulse shape, specified as a positive scalar value. For more information, see Algorithms.

Data Types: double

Length of frequency pulse shape, specified as a positive integer. This property represents the truncated frequency pulse length of the Gaussian pulse shape in symbol intervals.

Data Types: double

Symbol prehistory, specified as -1, 1, or a vector with elements equal those values. The symbol prehistory indicates the data symbols that the modulator uses before the object processes symbols, in reverse chronological order.

  • A scalar value expands to a vector of length PulseLength – 1.

  • For a vector, the length must be PulseLength – 1.

Data Types: double

Initial phase offset of the modulated waveform in radians, specified as a numeric scalar.

Data Types: double

Number of samples per input symbol, specified as a positive integer. The number of samples per symbol represents the downsampling factor from input samples to output samples.

Data Types: double

Traceback depth for the Viterbi algorithm or max-log-MAP algorithm, specified as a positive integer.

The traceback depth is the number of trellis branches that the Viterbi algorithm uses to construct each traceback path or that the max-log-MAP algorithm uses for the backward path metric calculation. The number of zero symbols that precede the first decoded symbol in the output represents a decoding delay.

Data Types: double

Output data type, specified as 'double', 'int8', 'int16', 'int32', or 'logical'.

  • When you set the BitOutput property to false, you can set the output data type to 'double', 'int8', 'int16', or 'int32'.

  • When you set the BitOutput property to true and DecisionMethod to 'Hard decision', you can set the output data type to 'double', 'int8', or 'logical'.

  • When you set the BitOutput property to true and DecisionMethod to 'Approximate log-likelihood ratio', the output data type is the same as the input, X.

Dependencies

This property applies when you set BitOutput to false, or when you set BitOutput to true and DecisionMethod to 'Hard decision'.

Usage

Description

Y = gmskdemodulator(X) applies GMSK demodulation to the GMSK-modulated waveform and returns the demodulated input signal.

example

Y = gmskdemodulator(X,nvar) returns the GMSK-demodulated input signal with the Variance property set to nvar. This syntax applies when you set VarianceSource to 'Input port' and DecisionMethod to 'Approximate log-likelihood ratio'.

Input Arguments

expand all

GMSK-modulated baseband signal, specified as a column vector with a length equal to an integer multiple of the number of SamplesPerSymbol.

This object accepts variable-size inputs. After the object is locked, you can change the frame size (number of rows) of the signal during simulation. For more information, see Variable-Size Signals in Code.

Data Types: double | single

Noise variance, specified as a positive scalar value.

Dependencies

This property applies when you set VarianceSource to 'Input port' and DecisionMethod to 'Approximate log-likelihood ratio'.

Data Types: double | single
Complex Number Support: Yes

Output Arguments

expand all

Demodulated signal, returned as a scalar or column vector with length equal to (N / SamplesPerSymbol). N is the length of the input signal, X, which is the number of input baseband modulated symbols.

  • When you set BitOutput to false, Y is returned as a column vector with element values of -1 or 1.

  • When you set BitOutput to true, the values returned in Y depend on the DecisionMethod property setting.

    • When you set DecisionMethod to 'Hard decision', Y is returned as a column vector with element values of 0 or 1.

    • When you set DecisionMethod to 'Approximate log-likelihood ratio', Y is returned as a column vector approximate log-likelihood ratios with positive values representing 0s and negative values representing 1s.

To specify the output data type, use the OutputDataType property.

Data Types: double | logical | int8 | int16 | int32

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

Create a GMSK modulator and demodulator pair. Create an AWGN channel object.

gmskmodulator = comm.GMSKModulator( ...
    BitInput=true, ...
    InitialPhaseOffset=pi/4);
gmskdemodulator = comm.GMSKDemodulator( ...
    BitOutput=true, ...
    InitialPhaseOffset=pi/4);
channel = comm.AWGNChannel( ...
    NoiseMethod='Signal to noise ratio (SNR)', ...
    SNR=0);

Create an error rate calculator and account for the delay between the modulator and demodulator, caused by the Viterbi algorithm.

errorRate = comm.ErrorRate( ...
    ReceiveDelay=gmskdemodulator.TracebackDepth);

Process 100 frames of data looping through these steps.

  1. Generate vectors with 300 elements of random binary data.

  2. GMSK-modulate the data.

  3. Pass the modulated data through the AWGN channel.

  4. GMSK-demodulate the data.

  5. Collect error statistics on the frames of data.

for counter = 1:100
   % Transmit 100 3-bit words
   data = randi([0 1],300,1);
   modSignal = gmskmodulator(data);
   noisySignal = channel(modSignal);
   receivedData = gmskdemodulator(noisySignal);
   errorStats = errorRate(data, receivedData);
end

Display the error statistics.

fprintf('Error rate = %f\nNumber of errors = %d\n', ...
         errorStats(1), errorStats(2))
Error rate = 0.000133
Number of errors = 4

This example shows how to estimate bit error rate (BER) of a Gaussian minimum shift keying (GMSK) modulated signal with convolutional coding. Additionally, this example compares the BER performance for hard-decision and soft-decision Viterbi decoders in AWGN.

Set the samples per symbol, EbNo range and data length.

rng default
sps = 4;                  % Samples per symbol
EbNoVec = 0:10;           % Eb/No values (dB)
dataLen = 5e2;            % Number of input bits per iteration

Create a trellis structure for a rate 1/2 convolutional code with a constraint length of 4. Set the traceback depth for the Viterbi decoder to 20. Specify the coding rate as 1/2.

trellis = poly2trellis(4,[17 13]);
vitTB = 20;
rate = 1/2;

Initialize the comm.ConvolutionalEncoder and comm.ViterbiDecoder System objects.

cEnc = comm.ConvolutionalEncoder(TrellisStructure=trellis);
decoderHard = comm.ViterbiDecoder(TrellisStructure=trellis,InputFormat="hard",TracebackDepth=vitTB);
decoderSoft = comm.ViterbiDecoder(TrellisStructure=trellis,InputFormat="Unquantized",TracebackDepth=vitTB);                        

Initialize the comm.GMSKModulator and comm.GMSKDemodulator System objects. GMSK modulation can be represented using a trellis structure. Viterbi algorithm is used for hard demodulation and max-log-MAP BCJR algorithm is used for soft demodulation. For more information, see the Algorithms section of comm.GMSKDemodulator.

gmskTB = 6;
gmskMod = comm.GMSKModulator(BitInput=true, ...
    PulseLength=2, ...
    SamplesPerSymbol=sps, ...
    BandwidthTimeProduct=0.5);
gmskDemodHard = comm.GMSKDemodulator(BitOutput=true, ...
    PulseLength=2, ...
    TracebackDepth=gmskTB, ...
    SamplesPerSymbol=sps, ...
    BandwidthTimeProduct=0.5);
gmskDemodSoft = comm.GMSKDemodulator(BitOutput=true, ...
    PulseLength=2, ...
    TracebackDepth=gmskTB, ...
    DecisionMethod="Approximate log-likelihood ratio",...
    SamplesPerSymbol=sps, ...
    BandwidthTimeProduct=0.5);

Initialize the BER result vectors.

berSoft = comm.ErrorRate("ReceiveDelay",vitTB); 
berHard = comm.ErrorRate("ReceiveDelay",vitTB);
[berEstSoft,berEstHard] = deal(zeros(size(EbNoVec))); 

The main processing loop performs these steps:

  • Generate binary data

  • Encode the data using convolutional code

  • Interleave the encoded data to avoid the possibility of burst errors

  • Apply GMSK modulation to the data symbols.

  • Pass the modulated signal through an AWGN channel

  • Demodulate the received signal using hard decision and approximate LLR methods.

  • Deinterleave the demodulated bits

  • Viterbi decode the signals using hard and unquantized methods

  • Calculate the number of bit errors

The while loop processes data until it encounters 100 errors or transmits 2e5 bits.

for n = 1:length(EbNoVec)

    % Convert Eb/No to SNR
    snrdB = convertSNR(EbNoVec(n),'ebno',CodingRate=rate,SamplesPerSymbol=sps); 

    % Noise variance calculation
    noiseVar = 10.^(-snrdB/10);

    % Reset the error and bit counters
    [numErrsSoft,numBits] = deal(0);

    gmskDemodSoft.Variance = noiseVar;

    while numErrsSoft < 100 && numBits < 2e5

        % Generate binary data
        dataIn = randi([0 1],dataLen,1);
        
        % Convolutionally encode the data
        dataEnc = cEnc(dataIn);
        
        % Interleave 
        intrData = matintrlv(dataEnc,5,length(dataEnc)/5); 

        % GMSK modulate
        txSig = gmskMod(intrData);
        
        % Pass through AWGN channel
        rxSig = awgn(txSig,snrdB,'measured');
        
        % Demodulate the noisy signal using hard decision (bit) and
        % soft decision (approximate LLR) approaches.
        demodHardOut = gmskDemodHard(rxSig);
        demodSoftOut = gmskDemodSoft(rxSig);
        
        if numBits > 0
        
        % Buffer data to account for delay
        deintrlvHardIn = [demHardBuffer(gmskTB+1:end);demodHardOut(1:gmskTB)];
        deintrlvSoftIn = [demSoftBuffer(gmskTB+1:end);demodSoftOut(1:gmskTB)];

        % Deinterleave        
        deintHardOut =  matdeintrlv(deintrlvHardIn,5,length(dataEnc)/5); 
        deintSoftOut =  matdeintrlv(deintrlvSoftIn,5,length(dataEnc)/5);

        % Viterbi decode
        dataHardOut = decoderHard(deintHardOut);
        dataSoftOut = decoderSoft(deintSoftOut);
        
        errHard = berHard(dataBuffer,dataHardOut);
        errSoft = berSoft(dataBuffer,dataSoftOut);

        % Store error counter
        numErrsSoft = errSoft(2);

        end

        numBits = numBits + dataLen;
        demHardBuffer = demodHardOut;
        demSoftBuffer = demodSoftOut;
        dataBuffer = dataIn;
    end
    release(cEnc)
    release(decoderHard)
    release(decoderSoft)
    release(gmskMod)
    release(gmskDemodHard)
    release(gmskDemodSoft)
    release(berSoft)
    release(berHard)

    % Log BER for both methods
    berEstSoft(n) = errSoft(1);
    berEstHard(n) = errHard(1);

end

Plot the estimated BER values for both hard and soft Viterbi decoding methods.

semilogy(EbNoVec,[berEstSoft;berEstHard],'-*')
hold on
legend('Soft-decision demodulation','Hard-decision demodulation','location','best')
grid
xlabel('Eb/No (dB)')
ylabel('Bit Error Rate')

Figure contains an axes object. The axes object with xlabel Eb/No (dB), ylabel Bit Error Rate contains 2 objects of type line. These objects represent Soft-decision demodulation, Hard-decision demodulation.

Algorithms

expand all

References

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

[2] Benedetto, S., G. Montorsi, D. Divsalar, and F. Pollara. "A Soft-Input Soft-Output Maximum A Posterior (MAP) Module to Decode Parallel and Serial Concatenated Codes." Jet Propulsion Lab TDA Progress Report (November 1996): 42–127.

[3] Viterbi, A.J. “An Intuitive Justification and a Simplified Implementation of the MAP Decoder for Convolutional Codes.” IEEE® Journal on Selected Areas in Communications 16, no. 2 (February 1998): 260–64. https://doi.org/10.1109/49.661114.

Extended Capabilities

expand all

Version History

Introduced in R2012a

expand all