MSK Signal Recovery

This example shows how to model channel impairments such as timing phase offset, carrier frequency offset, and carrier phase offset for a minimum shift keying (MSK) signal. The example also shows the use of System objects™ to synchronize such signals at the receiver.

Introduction

This example models an MSK transmitted signal undergoing channel impairments such as timing, frequency, and phase offset as well as AWGN noise. MSKTimingSynchronizer and CPMCarrierPhaseSynchronizer System objects recover the timing and phase offsets, while a delay-and-multiply scheme recovers the carrier frequency offset.

First, initialize system variables. See the MATLAB script configureMSKSignalRecoveryconfigureMSKSignalRecovery for details. Then, define control variables to specify that the system performs timing, carrier frequency, and carrier phase recovery.

configureMSKSignalRecovery;
recoverTimingPhase = true;
recoverCarrierFrequency = true;
recoverPhase = true;

Modeling Channel Impairments

Specify the sample delay, timingOffset, that the channel model applies and create a VariableFractionalDelay System object to introduce the timing delay to the transmitted signal.

timingOffset = 0.2;
hVFD = dsp.VariableFractionalDelay;

Create and configure a phase and frequency offset System object, hPFO, to introduce carrier phase and frequency offsets to the transmitted signal. Since the MSK modulator up-samples the transmitted symbols, set the SampleRate property appropriately.

freqOffset = 50;    % Frequency offset applied by the channel model
phaseOffset = 30;   % Phase offset applied by the channel model
hPFO = comm.PhaseFrequencyOffset('FrequencyOffset', freqOffset, ...
                'PhaseOffset', phaseOffset, ...
                'SampleRate', samplesPerSymbol/Ts);

Create an AWGN channel System object to add additive white Gaussian noise to the modulated signal. The noise power is determined by the bit energy to noise power spectral density ratio EbNo property. Since the MSK modulator generates symbols with 1 Watt of power, the signal power property of the AWGN channel is also set to 1.

EbNo = 60;          % in dB
hAWGN = comm.AWGNChannel('NoiseMethod', 'Signal to noise ratio (Eb/No)', ...
                'EbNo',EbNo,...
                'SignalPower', 1, ...
                'SamplesPerSymbol',samplesPerSymbol);

Timing, Carrier Frequency, and Carrier Phase Synchronization

Construct an MSK timing synchronizer to recover symbol timing phase using a fourth-order nonlinearity method.

hTimeSync = comm.MSKTimingSynchronizer('SamplesPerSymbol',samplesPerSymbol, ...
                    'ErrorUpdateGain',0.2);

Create and configure a delay, moving average filter, and cumulative sum System object to recover the carrier frequency using a combination of the 2P-power method and the delay-and-multiply scheme.

  • hDelayInstFreq - delay

  • hMovAve - moving average of the carrier frequency shift estimates over 100 frames

  • hCumSum - cumulative sum of the instantaneous frequency shift estimates

hDelayInstFreq = dsp.Delay;
hMovAve = dsp.DigitalFilter('TransferFunction','FIR (all zeros)', ...
              'Numerator', ones(1,100)/100);
hCumSum = dsp.CumulativeSum('Dimension','Channels (running sum)', ...
              'FrameBasedProcessing', true);

Create and configure a CPM carrier phase synchronizer object, hPhaseSync, to recover carrier phase using the 2P-Power method. This phase synchronizer is suitable for use with MSK modulated signals when the denominator of the modulation index property, P, is set to 2, which corresponds to MSK modulation.

hPhaseSync = comm.CPMCarrierPhaseSynchronizer('P',2, ...
                      'ObservationInterval',1000);

Stream Processing Loop

The system modulates data using MSK modulation. The modulated symbols pass through the channel model, which applies timing delay, carrier frequency and phase shift, and additive white Gaussian noise. In this system, the receiver performs timing, carrier frequency, and carrier phase recovery. Finally, the system demodulates the symbols and calculates the bit error rate using an error rate calculator System object. The plotResultsMSKSignalRecoveryplotResultsMSKSignalRecovery script generates scatter plots at three points in the system: after applying channel impairments, after carrier frequency synchronization, and after carrier phase synchronization. At the end of the simulation, the example displays the timing phase, frequency, and phase estimates as a function of simulation time.

for p = 1:numFrames
  %------------------------------------------------------------------------
  % Generate and modulate data
  %------------------------------------------------------------------------
  txBits = randi([0 1], samplesPerFrame, 1);
  txSym = step(hMod, txBits);
  %------------------------------------------------------------------------
  % Transmit through channel
  %------------------------------------------------------------------------
  chanSym = step(hVFD,txSym,timingOffset*samplesPerSymbol);  % Timing offset
  chanSym = step(hPFO,chanSym);         % Carrier frequency and phase offset
  chanSym = step(hAWGN, chanSym);       % Additive white Gaussian noise
  % Save the transmitted signal for plotting
  plot_rx = chanSym;
  %------------------------------------------------------------------------
  % Timing recovery
  %------------------------------------------------------------------------
  if recoverTimingPhase
    % Recover symbol timing phase using fourth-order nonlinearity method
    [rxSym timEst] = step(hTimeSync, chanSym);
    % Calculate the timing delay estimate for each sample
    timEst = timEst(1)/samplesPerSymbol;
  else
    % Do not apply timing recovery and simply downsample the received signal
    rxSym = downsample(chanSym, samplesPerSymbol);
    timEst = 0;
  end
  %------------------------------------------------------------------------
  % Carrier frequency recovery
  %------------------------------------------------------------------------
  if recoverCarrierFrequency
    % The following script applies carrier frequency recovery using a
    % combination of the 2P-power method and the delay-and-multiply scheme
    syncCarrierFreqMSKSignalRecovery;
  else
    freqShiftEst = 0;
  end
  % Save the carrier frequency synchronized received signal for plotting
  plot_rxFreqSync = rxSym;
  %------------------------------------------------------------------------
  % Carrier phase recovery
  %------------------------------------------------------------------------
  if recoverPhase
    % Recover carrier phase using 2P-Power method
    [rxSym, phEst] = step(hPhaseSync, rxSym);
    % Resolve phase ambiguity
    removePhaseAmbiguityMSKSignalRecovery;
  else
    phEst = 0;
  end
  % Save the phase synchronized received signal for plotting
  plot_rxPhSync = rxSym;
  %------------------------------------------------------------------------
  % Demodulate the received symbols
  %------------------------------------------------------------------------
  rxBits = step(hDemod, rxSym);
  %------------------------------------------------------------------------
  % Calculate the bit error rate
  %------------------------------------------------------------------------
  BER = step(hBER, txBits, rxBits);
  %------------------------------------------------------------------------
  % Plot results
  %------------------------------------------------------------------------
  plotResultsMSKSignalRecovery;
end   %#ok<*UNRCH,*SAGROW,*NOPTS>

Display the bit error rate, BitErrorRate, for Eb/N0 of 60 dB as well as the total number of symbols, NumberOfSymbols, processed by the error rate calculator.

BitErrorRate = BER(1)
NumberOfSymbols = BER(3)
BitErrorRate =

     0


NumberOfSymbols =

       99982

Conclusion

The constellation plots after timing, carrier frequency, and carrier phase synchronization provide a compelling visual rendition of the recovery algorithms in action. This is especially evident when you turn the synchronization algorithms on and off using the control variables: recoverTimingPhase, recoverCarrierFrequency, and recoverPhase.

Appendix

This example uses the following scripts and helper functions:

Was this topic helpful?