RF Wireless World

Browse articles, tutorials, tools, and vendors.

PSK Modulation in MATLAB: Code and Explanation

By RF Wireless Expert Team

This page provides MATLAB source code for PSK (Phase Shift Keying) modulation. The output plots and mathematical equations are also discussed.

PSK modulation is a digital modulation technique where the phase of the carrier signal varies according to the digital binary data (1 or 0).

Introduction:

  • Binary logic-1 typically represents a 180-degree phase shift of the carrier.
  • Binary logic-0 represents a 0-degree phase shift.

This type of PSK is also known as BPSK (Binary Phase Shift Keying).

PSK modulation

Fig.3 PSK Modulation

Figure 1 depicts the PSK modulation process. The inputs are digital binary data and an analog carrier signal, while the output is the analog PSK modulated signal.

PSK is a power-efficient system but offers lower bandwidth efficiency compared to other modulation schemes. Variants of PSK, such as 16-QAM, 64-QAM, and 256-QAM, are widely used in wireless communication for high data rate modulation.

Also, see the difference between ASK, FSK, and PSK modulation types.

PSK Matlab Code

clear;
clc;

b = input('Enter the Bit stream \n ');
%b = [0 1 0 1 1 1 0];
n = length(b);
t = 0:.01:n;
x = 1:1:(n+1)*100;

for i = 1:n
    if (b(i) == 0)
        b_p(i) = -1;
    else
        b_p(i) = 1;
    end

    for j = i:.1:i+1
        bw(x(i*100:(i+1)*100)) = b_p(i);
    end
end

bw = bw(100:end);
sint = sin(2*pi*t);
st = bw.*sint;

subplot(3,1,1)
plot(t,bw)
grid on ;
axis([0 n -2 +2])
subplot(3,1,2)
plot(t,sint)
grid on ;
axis([0 n -2 +2])
subplot(3,1,3)
plot(t,st)
grid on ;
axis([0 n -2 +2])

Input and Output of PSK Modulation Matlab Source Code

Run the downloaded PSKModulation.m file after unzipping the folder. Provide the input as prompted:

PSK matlab code input

After entering the input and pressing the “ENTER” key, you will see the output MATLAB image as shown below:

PSK matlab code output

Explore MATLAB Wireless Communications & Modulation

Continue Learning Modulation Types

Continue Learning MATLAB

Keep Reading