Code covered by the BSD License

# pi/4 DQPSK Modulation

### Mohsen Farhang (view profile)

Demonstrates modulation of a sequence of random symbols using pi/4 Differential Phase Shift Keying.

pi4dqpsk_Demo.m
```%*********************************************************************************
%****** pi/4 Differential Quadrature Phase Shift Keying Modulation*****
%**********************farhang.mohsen@gmail.com*************************
%********************************************************************************
%pi/4DQPSK is a popular variant of QPSK in which the phase change of
%pi/4DQPSK look http://en.wikipedia.org/wiki/Phase-shift_keying.
%
%This program Demonstrates modulation of a sequence of random
%symbols using pi/4DQPSK scheme and plots the scattered noisy
%symbols and trajectories.
%The variables (pi4dqpsk) and (pi4dqpsk_noisy) are the noise-free
%and noisy pi/4 DQPSK lowpass equivalents, respectively. The initial
%settings could be changed for different SNR, number of bits and
%initial state. (Demo is tested on R2011b and works properly)
%********************************************************************************

%-----------------------------------initial settings-----------------------------
clc%clear the command window
help pi4dqpsk_Demo %Introduction to Demo
clear%clear the workspace
SNR=25;%Signal to Noise Ratio in dB
n=1000;%number of bits to be modulated
d=randi(4,1,n/2)-1;%create n/2 random symbols from set {0,1,2,3}
IQ=[1;0]; %arbitrary initial state in InPhase-Quadrature
pi4dqpsk=zeros(1,n/2); %empty pi4dqpsk vector
%------------------------------------modulation------------------------------
for i=1:n/2
switch d(i)
case 0
theta=pi/4;
case 1
theta=3*pi/4;
case 2
theta=-3*pi/4;
case 3
theta=-pi/4;
end
a=[cos(theta) -sin(theta);sin(theta) cos(theta)];
IQ=a*IQ;
pi4dqpsk(i)=IQ(1)+IQ(2)*1j;
end
pi4dqpsk_noisy=awgn(pi4dqpsk,SNR,'measured');
%-----------------------------scatter plot & trajectory-----------------------
hScope = commscope.ScatterPlot;
hScope.SamplesPerSymbol = 1;
update(hScope,pi4dqpsk_noisy)
hScope.PlotSettings.SignalTrajectory='on';
hold on
scatter(real(pi4dqpsk),imag(pi4dqpsk),'ro');
%--------------------------------------------------------------------------```