Contenuto principale

DPSK Modulation-Demodulation Compatibility Considerations

Replace all instances of modem.dpskmod and modem.dpskdemod with comm.DPSKModulator and comm.DPSKDemodulator.

  • User-defined symbol mapping is not supported.

  • The comm.DPSKModulator System object™ does not support initial phase specification. However, this code sample shows you how to specify initial phase for DPSK-modulated signals:

    %% Initial Phase
    x = randi([0,7],10,1); 
    phRot = pi/8;
    initPh = pi/4;
    
    %% Using modem.dpskmod modulate the signal
    m = modem.dpskmod('M',8,'PhaseRotation',phRot,'InitialPhase',initPh);
    ym = modulate(m, x);
    
    %% Using comm.DPSKModulator modulate the signal
    s = comm.DPSKModulator('PhaseRotation',phRot,'SymbolMapping','Binary');
    ys = s(x);
    ys1 = ys .* exp(1i * initPh);
    
    %% Compare results
    err = max(abs(ys1 - ym))
    
    err =
    
       2.6390e-15
    

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

    %% Multichannel input/output
    x = randi([0,7],10,3);
    phRot = pi/8;
    
    %% Using modem.dpskmod modulate the signal
    m = modem.dpskmod('M',8,'PhaseRotation',phRot);
    ym1 = m.modulate(x);
    % Process one more frame to verify interframe state handling
    ym2 = m.modulate(x);
    
    %% Using comm.DPSKModulator modulate the signal
    % Create as many System objects as number of channels
    s1 = comm.DPSKModulator('PhaseRotation',phRot,'SymbolMapping','Binary');
    s2 = comm.DPSKModulator('PhaseRotation',phRot,'SymbolMapping','Binary');
    s3 = comm.DPSKModulator('PhaseRotation',phRot,'SymbolMapping','Binary');
    
    ys1 = complex(zeros(size(x),'like',x));
    ys2 = ys1;
    
    % Process first frame
    % Process each channel by its specific System object
    ys1(:,1) = s1(x(:,1)); 
    ys1(:,2) = s2(x(:,2)); 
    ys1(:,3) = s3(x(:,3)); 
    
    % Process second frame
    ys2(:,1) = s1(x(:,1)); 
    ys2(:,2) = s2(x(:,2)); 
    ys2(:,3) = s3(x(:,3)); 
    
    %% Compare results
    err1 = (max(abs(ys1(:) - ym1(:))))
    err2 = (max(abs(ys2(:) - ym2(:))))
    
    
    err1 =
    
       2.0411e-15
    
    err2 =
    
       2.4431e-15