Main Content

OQPSK Modulation-Demodulation Compatibility Considerations

Replace all instances of modem.oqpskmod and modem.oqpskdemod with comm.OQPSKModulator and comm.OQPSKDemodulator.

  • This code sample shows you how to simulate multichannel input/output for OQPSK-modulated signals:

    %% Multichannel input/output OQPSK modulation
    m = 4;
    numChan = 3;
    x = randi([0,m-1],10,numChan);
    sps = 2; % Samples per symbol
    
    %% Using modem.oqpskmod modulate the signal
    m_oqpsk = modem.oqpskmod();
    ym1 = m_oqpsk.modulate(x);
    % Process one more frame to verify interframe state handling
    ym2 = m_oqpsk.modulate(x);
    
    %% Using comm.OQPSKModulator modulate the signal
    % Create as many System objects as number of channels
    s1_oqpsk = comm.OQPSKModulator('SymbolMapping','Binary','SamplesPerSymbol',sps);
    s2_oqpsk = comm.OQPSKModulator('SymbolMapping','Binary','SamplesPerSymbol',sps);
    s3_oqpsk = comm.OQPSKModulator('SymbolMapping','Binary','SamplesPerSymbol',sps);
    
    % Preallocate output matrix
    ys1 = complex(zeros(sps*length(x),numChan,'like',x));
    ys2 = ys1;
    
    % Process first frame
    % Process each channel by its specific System object
    ys1(:,1) = s1_oqpsk(x(:,1)); 
    ys1(:,2) = s2_oqpsk(x(:,2)); 
    ys1(:,3) = s3_oqpsk(x(:,3));
    
    % Process second frame
    ys2(:,1) = s1_oqpsk(x(:,1)); 
    ys2(:,2) = s2_oqpsk(x(:,2)); 
    ys2(:,3) = s3_oqpsk(x(:,3)); 
    
    % The modulated signals are not compared because the 
    % comm.OQPSKModulator performs joint filtering and 
    % modulation of the signal, while the modem.oqpskmod 
    % only modulates the signal.
    
    

  • The comm.OQPSKDemodulator System object™ does not support soft decision output for OQPSK-modulated signals. However, this code sample shows you how to simulate soft decision output for OQPSK-modulated signals:qamdemod

    %% Soft decision OQPSK demodulation
    % Create an OQPSK signal and add noise to the signal
    sps = 4;
    msg = randi([0 1],1000,1);
    oqpskMod = comm.OQPSKModulator('SamplesPerSymbol',sps,'BitInput',true);
    oqpskSig = oqpskMod(msg);
    
    impairedSig = awgn(oqpskSig,15);
    
    % Soft-demodulate using the qamdemod function
    
    % Align I and Q (create QPSK equivalent signal)
    impairedQPSK = complex(real(impairedSig(1+sps/2:end-sps/2)), imag(impairedSig(sps+1:end)));
    
    % Apply matched filtering to the received OQPSK signal
    halfSinePulse = sin(0:pi/sps:(sps)*pi/sps);
    matchedFilter = dsp.FIRDecimator(sps,halfSinePulse,'DecimationOffset',sps/2);
    filteredQPSK = matchedFilter(impairedQPSK);
    
    % To perform soft demodulation of the filtered OQPSK signal use the 
    % qamdemod function. Align symbol mapping of qamdemod with the symbol
    % mapping used by the comm.OQPSKModulator, then demodulate the signal.
    oqpskModSymbolMapping = [1 3 0 2];
    demodulated = qamdemod(filteredQPSK,4,oqpskModSymbolMapping,'OutputType','llr');