Main Content

comm.MSKModulator

Modulate using MSK method

Description

The MSKModulator object modulates using the minimum shift keying method. The output is a baseband representation of the modulated signal. The initial phase offset property sets the initial phase of the output waveform, measured in radians.

To modulate a signal using minimum shift keying:

  1. Define and set up your MSK modulator object. See Construction.

  2. Call step to modulate the signal according to the properties of comm.MSKModulator. 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.

Construction

H = comm.MSKModulator creates a modulator System object, H. This object modulates the input signal using the minimum shift keying (MSK) modulation method.

H = comm.MSKModulator(Name,Value) creates an MSK modulator object, H, 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).

Properties

BitInput

Assume bit inputs

Specify whether the input is bits or integers. The default is false.

When you set the BitInput property to false, the step method input must be a column vector with a double-precision or signed integer data type and of values equal to -1 or 1.

When you set the BitInput property to true, the step method input requires double-precision or logical data type column vector of 0s and 1s.

InitialPhaseOffset

Initial phase offset

Specify the initial phase of the modulated waveform in radians as a real, numeric scalar value. The default is 0.

SamplesPerSymbol

Number of samples per output symbol

Specify the upsampling factor at the output as a real, positive, integer scalar value. The default is 8. The upsampling factor indicates the number of output samples that the step method produces for each input sample.

OutputDataType

Data type of output

Specify output data type as one of double | single. The default is double.

Methods

resetReset states of the MSK modulator object
stepModulate using MSK method
Common to All System Objects
release

Allow System object property value changes

Examples

collapse all

% Create an MSK modulator, an AWGN channel, and an MSK demodulator.  Use a
% phase offset of pi/4.
 hMod = comm.MSKModulator('BitInput', true, ...
                    'InitialPhaseOffset', pi/4);
    hAWGN = comm.AWGNChannel('NoiseMethod', ...
                    'Signal to noise ratio (SNR)','SNR',0);
    hDemod = comm.MSKDemodulator('BitOutput', true, ...
                    'InitialPhaseOffset', pi/4);
 % Create an error rate calculator, account for the delay caused by the Viterbi algorithm
    hError = comm.ErrorRate('ReceiveDelay', hDemod.TracebackDepth);
    for counter = 1:100
      % Transmit 100 3-bit words
      data = randi([0 1],300,1);
      modSignal = step(hMod, data);
      noisySignal = step(hAWGN, modSignal);
      receivedData = step(hDemod, noisySignal);
      errorStats = step(hError, data, receivedData);
    end
    fprintf('Error rate = %f\nNumber of errors = %d\n', ...
      errorStats(1), errorStats(2))
Error rate = 0.000000
Number of errors = 0

This example illustrates the mapping of binary sequences of zeros and ones to the output of a GMSK modulator. The relationship also applies for MSK modulation.

Create a GMSK modulator that accepts binary inputs. Specify the pulse length and samples per symbol to be 1.

gmsk = comm.GMSKModulator('BitInput',true,'PulseLength',1,'SamplesPerSymbol',1);

Create an input sequence of all zeros. Modulate the sequence.

x = zeros(5,1);
y = gmsk(x)
y = 5×1 complex

   1.0000 + 0.0000i
  -0.0000 - 1.0000i
  -1.0000 + 0.0000i
   0.0000 + 1.0000i
   1.0000 - 0.0000i

Determine the phase angle for each point. Use the unwrap function to better show the trend.

theta = unwrap(angle(y))
theta = 5×1

         0
   -1.5708
   -3.1416
   -4.7124
   -6.2832

A sequence of zeros causes the phase to shift by -π/2 between samples.

Reset the modulator. Modulate an input sequence of all ones.

reset(gmsk)
x = ones(5,1);
y = gmsk(x)
y = 5×1 complex

   1.0000 + 0.0000i
  -0.0000 + 1.0000i
  -1.0000 - 0.0000i
   0.0000 - 1.0000i
   1.0000 + 0.0000i

Determine the phase angle for each point. Use the unwrap function to better show the trend.

theta = unwrap(angle(y))
theta = 5×1

         0
    1.5708
    3.1416
    4.7124
    6.2832

A sequence of ones causes the phase to shift by +π/2 between samples.

Compare Gaussian minimum shift keying (GMSK) and minimum shift keying (MSK) modulation schemes by plotting the eye diagram for GMSK with different pulse lengths and for MSK.

Set the samples per symbol variable.

sps = 8;

Generate random binary data.

data = randi([0 1],1000,1);

Create GMSK and MSK modulators that accept binary inputs. Set the PulseLength property of the GMSK modulator to 1.

gmskMod = comm.GMSKModulator('BitInput',true,'PulseLength',1, ...
    'SamplesPerSymbol',sps);
mskMod = comm.MSKModulator('BitInput',true,'SamplesPerSymbol',sps);

Modulate the data using the GMSK and MSK modulators.

modSigGMSK = gmskMod(data);
modSigMSK = mskMod(data);

Pass the modulated signals through an AWGN channel having an SNR of 30 dB.

rxSigGMSK = awgn(modSigGMSK,30);
rxSigMSK = awgn(modSigMSK,30);

Use the eyediagram function to plot the eye diagrams of the noisy signals. With the GMSK pulse length set to 1, the eye diagrams are nearly identical.

eyediagram(rxSigGMSK,sps,1,sps/2)

eyediagram(rxSigMSK,sps,1,sps/2)

Set the PulseLength property for the GMSK modulator object to 3. Because the property is nontunable, the object must be released first.

release(gmskMod)
gmskMod.PulseLength = 3;

Generate a modulated signal using the updated GMSK modulator object and pass it through the AWGN channel.

modSigGMSK = gmskMod(data);
rxSigGMSK = awgn(modSigGMSK,30);

With continuous phase modulation (CPM) waveforms, such as GSMK, the waveform depends on values of the previous symbols as well as the present symbol. Plot the eye diagram of the GMSK signal to see that the increased pulse length results in an increase in the number of paths in the eye diagram.

eyediagram(rxSigGMSK,sps,1,sps/2)

Experiment by changing the PulseLength parameter of the GMSK modulator object to other values. If you set the property to an even number, you should set gmskMod.InitialPhaseOffset to pi/4 and update the offset argument of the eyediagram function from sps/2 to 0 for a better view of the modulated signal. In order to more clearly view the Gaussian pulse shape, you must use scopes that display the phase of the signal, as described in the CPM Phase Tree example.

Algorithms

This object implements the algorithm, inputs, and outputs described on the MSK Demodulator Baseband block reference page. The object properties correspond to the block parameters. For MSK the phase shift per symbol is π/2, which is a modulation index of 0.5.

Extended Capabilities

Introduced in R2012a