QPSK – Quadrature Phase Shift Keying

Quadrature Phase Shift Keying (QPSK) is a form of phase modulation technique, in which two information bits (combined as one symbol) are modulated at once, selecting one of the four possible carrier phase shift states.

Figure 1: Waveform simulation model for Quadrature Phase Shift Keying modulation
Figure 1: Waveform simulation model for QPSK modulation

The QPSK signal within a symbol duration \(T_{sym}\) is defined as

\[s(t) = A \cdot cos \left[2 \pi f_c t + \theta_n \right], \quad \quad 0 \leq t \leq T_{sym},\; n=1,2,3,4 \quad \quad (1) \]

where the signal phase is given by

\[\theta_n = \left(2n – 1 \right) \frac{\pi}{4} \quad \quad (2)\]

Therefore, the four possible initial signal phases are \(\pi/4, 3 \pi/4, 5 \pi/4\) and \(7 \pi/4\) radians. Equation (1) can be re-written as

\[\begin{align} s(t) &= A \cdot cos \theta_n \cdot cos \left( 2 \pi f_c t\right) – A \cdot sin \theta_n \cdot sin \left( 2 \pi f_c t\right) \\ &= s_{ni} \phi_i(t) + s_{nq} \phi_q(t) \quad\quad \quad \quad \quad\quad \quad \quad \quad\quad \quad \quad \quad\quad \quad \quad (3) \end{align} \]

The above expression indicates the use of two orthonormal basis functions: \( \left\langle \phi_i(t),\phi_q(t)\right\rangle\) together with the inphase and quadrature signaling points: \( \left\langle s_{ni}, s_{nq}\right\rangle\). Therefore, on a two dimensional co-ordinate system with the axes set to \( \phi_i(t)\) and \(\phi_q(t)\), the QPSK signal is represented by four constellation points dictated by the vectors \(\left\langle s_{ni}, s_{nq}\right\rangle\) with \( n=1,2,3,4\).

This article is part of the following books
Digital Modulations using Matlab : Build Simulation Models from Scratch, ISBN: 978-1521493885
Digital Modulations using Python ISBN: 978-1712321638
All books available in ebook (PDF) and Paperback formats

The transmitter

The QPSK transmitter, shown in Figure 1, is implemented as a matlab function qpsk_mod. In this implementation, a splitter separates the odd and even bits from the generated information bits. Each stream of odd bits (quadrature arm) and even bits (in-phase arm) are converted to NRZ format in a parallel manner.

Refer Digital Modulations using Matlab : Build Simulation Models from Scratch for full Matlab code.
Refer Digital Modulations using Python for full Python code

File 1: qpsk_mod.m: QPSK modulator

function [s,t,I,Q] = qpsk_mod(a,fc,OF)
%Modulate an incoming binary stream using conventional QPSK
%a - input binary data stream (0's and 1's) to modulate
%fc - carrier frequency in Hertz
%OF - oversampling factor (multiples of fc) - at least 4 is better
%s - QPSK modulated signal with carrier
%t - time base for the carrier modulated signal
%I - baseband I channel waveform (no carrier)
%Q - baseband Q channel waveform (no carrier)
L = 2*OF;%samples in each symbol (QPSK has 2 bits in each symbol)
ak = 2*a-1; %NRZ encoding 0-> -1, 1->+1
I = ak(1:2:end);Q = ak(2:2:end);%even and odd bit streams
I=repmat(I,1,L).'; Q=repmat(Q,1,L).';%even/odd streams at 1/2Tb baud
I = I(:).'; Q = Q(:).'; %serialize
fs = OF*fc; %sampling frequency
t=0:1/fs:(length(I)-1)/fs; %time base
iChannel = I.*cos(2*pi*fc*t);qChannel = -Q.*sin(2*pi*fc*t);
s = iChannel + qChannel; %QPSK modulated baseband signal

The timing diagram for BPSK and QPSK modulation is shown in Figure 2. For BPSK modulation the symbol duration for each bit is same as bit duration, but for QPSK the symbol duration is twice the bit duration: \(T_{sym}=2T_b\). Therefore, if the QPSK symbols were transmitted at same rate as BPSK, it is clear that QPSK sends twice as much data as BPSK does. After oversampling and pulse shaping, it is intuitively clear that the signal on the I-arm and Q-arm are BPSK signals with symbol duration \(2T_b\). The signal on the in-phase arm is then multiplied by \(cos (2 \pi f_c t)\) and the signal on the quadrature arm is multiplied by \(-sin (2 \pi f_c t)\). QPSK modulated signal is obtained by adding the signal from both in-phase and quadrature arms.

Note: The oversampling rate for the simulation is chosen as \(L=2 f_s/f_c\), where \(f_c\) is the given carrier frequency and \(f_s\) is the sampling frequency satisfying Nyquist sampling theorem with respect to the carrier frequency (\(f_s \geq f_c\)). This configuration gives integral number of carrier cycles for one symbol duration.

Timing diagram for BPSK and QPSK modulations
Figure 2: Timing diagram for BPSK and QPSK modulations

The receiver

Due to its special relationship with BPSK, the QPSK receiver takes the simplest form as shown in Figure 3. In this implementation, the I-channel and Q-channel signals are individually demodulated in the same way as that of BPSK demodulation. After demodulation, the I-channel bits and Q-channel sequences are combined into a single sequence. The function qpsk_demod implements a QPSK demodulator as per Figure 3.

Read more about QPSK, implementation of their modulator and demodulator, performance simulation in these books:

Waveform simulation model for Quadrature Phase Shift Keying demodulation
Figure 3: Waveform simulation model for QPSK demodulation

Performance simulation over AWGN

The complete waveform simulation for the aforementioned QPSK modulation and demodulation is given next. The simulation involves, generating random message bits, modulating them using QPSK modulation, addition of AWGN channel noise corresponding to the given signal-to-noise ratio and demodulating the noisy signal using a coherent QPSK receiver. The waveforms at the various stages of the modulator are shown in the Figure 4.

Simulated Quadrature Phase Shift Keying waveforms at the transmitter side
Figure 4: Simulated QPSK waveforms at the transmitter side

The performance simulation for the QPSK transmitter-receiver combination was also coded in the code given above and the resulting bit-error rate performance curve will be same as that of conventional BPSK. A QPSK signal essentially combines two orthogonally modulated BPSK signals. Therefore, the resulting performance curves for QPSK – \(E_b/N_0\) Vs. bits-in-error – will be same as that of conventional BPSK.

QPSK variants

QPSK modulation has several variants, three such flavors among them are: Offset QPSK, π/4-QPSK and π/4-DQPSK.

Offset-QPSK

Offset-QPSK is essentially same as QPSK, except that the orthogonal carrier signals on the I-channel and the Q-channel are staggered (one of them is delayed in time). In OQPSK, the orthogonal components cannot change states at the same time, this is because the components change state only at the middle of the symbol periods (due to the half symbol offset in the Q-channel). This eliminates 180° phase shifts all together and the phase changes are limited to 0° or 90° every bit period.

Elimination of 180° phase shifts in OQPSK offers many advantages over QPSK. Unlike QPSK, the spectrum of OQPSK remains unchanged when band-limited [1]. Additionally, OQPSK performs better than QPSK when subjected to phase jitters [2]. Further improvements to OQPSK can be obtained if the phase transitions are avoided altogether – as evident from continuous modulation schemes like Minimum Shift Keying (MSK) technique.

π/4-QPSK and π/4-DQPSK

In π/4-QPSK, the signaling points of the modulated signals are chosen from two QPSK constellations that are just shifted π/4 radians (45°) with respect to each other. Switching between the two constellations every successive bit ensures that the phase changes are confined to odd multiples of 45°. Therefore, phase transitions of 90° and 180° are eliminated.

π/4-QPSK preserves the constant envelope property better than QPSK and OQPSK. Unlike QPSK and OQPSK schemes, π/4-QPSK can be differentially encoded, therefore enabling the use of both coherent and non-coherent demodulation techniques. Choice of non-coherent demodulation results in simpler receiver design. Differentially encoded π/4-QPSK is referred as π/4-DQPSK.

Read more about QPSK and its variants, implementation of their modulator and demodulator, performance simulation in these books:

Constellation diagram

The phase transition properties of the different variants of QPSK schemes, are easily investigated using constellation diagram. Refer this article that discusses the method to plot signal space constellations, for the various modulations used in the transmitter.

Constellation diagrams for raised cosine filtered QPSK, OQPSK, DQPSK and MSK
Figure 5: Constellations plots for: (a) a = 0.3 RC-filtered QPSK, (b) α = 0.3 RC-filtered O-QPSK, (c) α = 0.3 RC-filtered π/4-DQPSK and (d) MSK

Refer Digital Modulations using Matlab : Build Simulation Models from Scratch for full Matlab code.
Refer Digital Modulations using Python for full Python code

Rate this article: PoorBelow averageAverageGoodExcellent (62 votes, average: 3.11 out of 5)

References

[1] S. A. Rhodes, “Effects of hardlimiting on bandlimited transmissions with conventional and offset QPSK modulation”, in Proc. Nat. TeIecommun. Conf., Houston, TX, 1972, PP. 20F/1-20F/7
[2] S. A. Rhodes, “Effect of noisy phase reference on coherent detection of offset QPSK signals”, IEEE Trans. Commun., vol. COM-22, PP. 1046-1055, Aug. 1974.↗

Books by the author

Wireless Communication Systems in Matlab
Wireless Communication Systems in Matlab
Second Edition(PDF)

PoorBelow averageAverageGoodExcellent (180 votes, average: 3.62 out of 5)

Digital modulations using Python
Digital Modulations using Python
(PDF ebook)

PoorBelow averageAverageGoodExcellent (134 votes, average: 3.56 out of 5)

digital_modulations_using_matlab_book_cover
Digital Modulations using Matlab
(PDF ebook)

PoorBelow averageAverageGoodExcellent (136 votes, average: 3.63 out of 5)

Hand-picked Best books on Communication Engineering
Best books on Signal Processing

Topics in this chapter

Digital Modulators and Demodulators - Passband Simulation Models
Introduction
Binary Phase Shift Keying (BPSK)
 □ BPSK transmitter
 □ BPSK receiver
 □ End-to-end simulation
Coherent detection of Differentially Encoded BPSK (DEBPSK)
● Differential BPSK (D-BPSK)
 □ Sub-optimum receiver for DBPSK
 □ Optimum noncoherent receiver for DBPSK
Quadrature Phase Shift Keying (QPSK)
 □ QPSK transmitter
 □ QPSK receiver
 □ Performance simulation over AWGN
● Offset QPSK (O-QPSK)
● π/p=4-DQPSK
● Continuous Phase Modulation (CPM)
 □ Motivation behind CPM
 □ Continuous Phase Frequency Shift Keying (CPFSK) modulation
 □ Minimum Shift Keying (MSK)
Investigating phase transition properties
● Power Spectral Density (PSD) plots
Gaussian Minimum Shift Keying (GMSK)
 □ Pre-modulation Gaussian Low Pass Filter
 □ Quadrature implementation of GMSK modulator
 □ GMSK spectra
 □ GMSK demodulator
 □ Performance
● Frequency Shift Keying (FSK)
 □ Binary-FSK (BFSK)
 □ Orthogonality condition for non-coherent BFSK detection
 □ Orthogonality condition for coherent BFSK
 □ Modulator
 □ Coherent Demodulator
 □ Non-coherent Demodulator
 □ Performance simulation
 □ Power spectral density

29 thoughts on “QPSK – Quadrature Phase Shift Keying”

  1. Sir, how to apply MAP criteria in QPSK.
    if symbol have different transmission probability, how to decide boundary?

    Reply
  2. i need some one to help me to do QPSK mappinf for OFDM using loop
    clc; clear all;close all;
    nsp=16384;
    ns=4;
    M=4;
    % tirage aléatoire de symbole de 0 à 3
    r=randi([0 3],1,nsp);

    % mapping qpsk
    for i=1:2:length(r)

    Reply
  3. hi
    i think there is a small error in the line:
    ‘Modulation is achieved by varying the phase of the basis functions depending on the message symbols.’

    instead of the word ‘phase’ in the above line, it should be amplitude of the basis functions depends on the message symbol. the linear combination of the basis functions in turn results in the output function whose phase depends on the message symbol.

    Reply
  4. Hello sir,
    can i ask q here if can
    Digital information is to be transmitted by digital modulation through an additive white
    Gaussian noise channel with a required bit error probability, Pb of 2×10-4. Evaluate the
    dependency of the bit error probability, Pb, on Eb/N0 in dB, of the modulation schemes DPSK
    and 8-PSK. If the system’s main criterion is the bit error probability, Pb, which of these
    modulation schemes would you choose? Provide your answer by showing calculations.

    Reply
  5. Hello sir,
    I need The Matlab code of QPSK 2*2 MIMO with no channel coding using MMSE Receiver and hard detection. (Rayleigh channel) used BER curves to show performance…plz i need it urgently…. my Email numb is .. [email protected]

    Reply
  6. Hello Sir:

    thank you for all this infromations.

    i want to use the Square Root Raised Cosine encoder in place of NRZ Encoder for QPSK modulation.
    my idea is used the ideal pulse and after that we using the the Square Root Raised Cosine filter.is this correct and i want to know what is the transfer function of this filter. if you can help me with this program.

    Reply
    • Actually, Just for checking a Theoretical important problem, Square Root Raised Cosine filter does not have a relation with your NRZ Stream, it’s just a pulse shaping of your NRZ Stream it means that you wanna send for example 1 -1 1 -1 -1 1 , … then the signal analogue that specifies to 1 will be 1 * Cosine filter and for -1 will be (-1)* Cosine wave, … which effectively depends on your sampling frquency of filter that you have choosen and the rol of factor of pulse,

      So my solution for you is at first upsample of your NRZ data arbiary (4,8 or 16 , …) and then taking convolution of upsampled data and root raised cosine filter will have give simply the output that you need. and now it’s your ready signal to modulation.

      Matlab code :
      N = 10^4 ; % number of data
      up = 4; % upsampling data
      d = randsrc(1,N);

      du = upsample (d,up);
      x = conv(du,Root_Raised_Cosine); % your ready signal to go to modulate

      Reply
      • i have Q
        can u help me
        Digital information is to be transmitted by digital modulation through an additive white
        Gaussian noise channel with a required bit error probability, Pb of 2×10-4. Evaluate the
        dependency of the bit error probability, Pb, on Eb/N0 in dB, of the modulation schemes DPSK
        and 8-PSK. If the system’s main criterion is the bit error probability, Pb, which of these
        modulation schemes would you choose? Provide your answer by showing calculations.

        Reply
        • Hello,
          This link gives the idea of using different modulation schemes for your bit stream and the important Bir Error Rate curve which is also used in practice:
          https://www.gaussianwaves.com/2010/04/performance-comparison-of-digital-modulation-techniques-2/
          The figure in this link shows well the more you increase the symbols (BPSK, QPSK, 8PSK , …) the more the probability of error is going to be increased. Becasue simply there is more bits to be wrong. So for a fixed Power (SNR) you have a better performance for BPSK.

          But in the cost that your bit rate is the smallest possible in your system.
          otherwise you can have maximum bit rate.

          Reply
  7. Hi I tried the program for QPSK modulation and demodulation …. but am getting an error consistently…

    Error in ==> QPSK at 10

    [evenTime,evenNrzData,Fs]=NRZ_Encoder(evenBits,Rb,amplitude,’Polar’);

    What do I do for this… Is there something I need to do to prevent this error….

    Reply
  8. I mean, in the program provided by you, I changed one of the input parameter in NRZEncoder function from polar to unipolar.

    Reply
    • Hi,
      QPSK modulation is achieved using NRZ (polar) encoding method. If you use unipolar encoding the constellations in trasmitter and receiver will be different.
      QPSK modulation has to be simulated with polar encoding. Simulating using unipolar, zeros out the sine/cos components. Because of that your bits are detected wrongly

      In QPSK, the inphase component is multiplied by cos and quadrature component by sine. For polar encoding, inphase and quadrature phase components are either +1 and -1 . So there is no problem here.
      But when you use unipolar encoding, the inphase or quadrature phase components take value 0 or 1. The value ‘0’ will nullify the corresponding cos or sine component and there is no way to recover from this error.

      It is not recommended to use unipolar encoding for QPSK modulation as it defeats the basic architecture of the modulation itself.

      Hope this helps.

      Reply
      • Hello Mathuranathan
        I tried to get BER Vs Eb/N0 graph of passband QPSK modultion.
        I chosed N = 1e6 samples of bits and used your code in a loop.
        The result was that the BER was zero every time even if I had increased the noise varianc (I actually deceased the SNR).
        How can I get the BER Vs Eb/N0 graph for passband ?

        Reply
  9. I tried this code using unipolar and polar line coding. With polar coding, the reconstructed bit sequence was okay. but with unipolar coding, the reconstructed bit sequence always appeared same (all 1s) in almost all cases. Can anyone tell me the reason for this behaviour ?

    Reply
  10. hi
    i think there is a small error in the line:
    ‘Modulation is achieved by varying the phase of the basis functions depending on the message symbols.’

    instead of the word ‘phase’ in the above line, it should be amplitude of the basis functions depends on the message symbol. the linear combination of the basis functions in turn results in the output function whose phase depends on the message symbol.

    Reply
  11. Hi Naveed,
    Understand that the NRZ encoder converts 0’s and 1’s into -1 and +1 respectively. In any digital modulation technique, the user input interms of 0’s and 1’s has to be converted to -1’s and +1s, each bits with a definite bit duration. For this purpose, a NRZ encoder is used.

    Reply
  12. Hi Mathuranathan,

    I am new to MATLAB and i need some help in generating MATLAB code for QPSK. I have tried to modify your code to produce the required result but no success. I need to generate/plot a polarised version of the bit stream “00 01 01 01 01 10 11 10” for input into a QPSK modulator (odd bits = 00 00 01 11; even bits =01 11 10 10). I also need a polarised version of the odd and even bits plotted. The odd and even bits are then multiplied by +/-(sqrt2) and then modulated by carriers cos(wt) and -sin(wt). The two modulated signals are then combined to produce QPSK. plots of the modulated odd bits, modulated even bits and the QPSK signals included. The carrier frequency is 1600Hz with two cycles of carrier during each symbol (baud rate =800 symbols per sec, symbol duration =1.25mS).

    At the other end, a plot of the two demodulated signals and the instantaneous waveforms of the integrators.

    Reply
  13. Hi Mathuranathan,

    I am new to MATLAB and i need some help in generating MATLAB code for QPSK. I have tried to modify your code to produce the required result but no success. I need to generate/plot a polarised version of the bit stream “00 01 01 01 01 10 11 10” for input into a QPSK modulator (odd bits = 00 00 01 11; even bits =01 11 10 10). I also need a polarised version of the odd and even bits plotted. The odd and even bits are then multiplied by +/-(sqrt2) and then modulated by carriers cos(wt) and -sin(wt). The two modulated signals are then combined to produce QPSK. plots of the modulated odd bits, modulated even bits and the QPSK signals included. The carrier frequency is 1600Hz with two cycles of carrier during each symbol (baud rate =800 symbols per sec, symbol duration =1.25mS).

    At the other end, a plot of the two demodulated signals and the instantaneous waveforms of the integrators.

    Reply
  14. That is equation is for non-offset QPSK. PSK modulation has lot of variations like OQPSK (offset QPSK), pi/4-QPSK, DQPSK (differential QPSK),etc..,

    In reality pi/4-QPSK modulation uses two constellations (dual constellations) which are shifted by 45* with respect to each other. Only either the odd or even symbol are allowed to select a point from one of the constellations while the other chooses the point from the other constellation.

    This reduces the maximum phase shift from 180* to 135*. Reduction of maximum phase shift implies reduction of bandwidth and reduction of overshoot (minimized side lobes)

    Reply

Post your valuable comments !!!