Binary Phase shift keying (BPSK) is one of the basic modulation schemes in which the phase of the carrier signal is varied or switched according to the input message pulses. When the modulation input is at logic 1, a finite number of cycles of a sinusoidal signal are transmitted and when the input is at logic 0, the phase of the sinusoid is changed. We have discussed in detail binary phase-shift keying and applications of PSK modulation before. Comments are given for a better understanding of this Matlab program for BPSK modulation.
Matlab Program for PSK / Matlab Code for PSK
clear all; clc; close all; A=5; t=0:.001:1; f1=input("Carrier Sine wave frequency ="); f2=input("Message frequency ="); x=A.*sin(2*pi*f1*t);%Carrier Sine subplot(3,1,1); plot(t,x); xlabel("time"); ylabel("Amplitude"); title("Carrier"); grid on; u=square(2*pi*f2*t);%Message signal subplot(3,1,2); plot(t,u); xlabel("time"); ylabel("Amplitude"); title("Message Signal"); grid on; v=x.*u;%Sine wave multiplied with square wave subplot(3,1,3); plot(t,v); axis([0 1 -6 6]); xlabel("t"); ylabel("y"); title("PSK"); grid on;
Generated PSK Signal
Carrier Sine wave frequency =10
Message frequency =2
Besides the PSK modulation code in MATLAB, we have also come up with MATLAB programs for other modulation processes like FSK.