MSK matlab code | MSK modulation matlab source code

This page of MATLAB source code covers MSK matlab code. The output plots and mathematical equations of MSK modulation matlab code are mentioned. MSK modulation stands for Minimum Shift Keying Modulation.

Introduction:
MSK modulation is derived from OQPSK modulation. OQPSK offers maximum pahse shift of 45 degree between two transitions. MSK offers 0 degree phase shift between transitions. MSK modulation uses half cycle sine wave instead of rectangular pulse wave. In MSK, frequency of logic-0 and logic-1 differs by half of data rate. MSK equation and modulation waveforms are depicted below.

MSK equation
Fig.1 MSK Equation

MSK
Fig.2 MSK modulation for NRZ data signal in time domain

Refer MSK versus GMSK>> which explains time domain waveforms of MSK and GMSK modulation types with their respective mathematical equations.

MSK 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+2)*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);
if (mod(i,2) == 0)
bow(x(i*100:(i+1)*100)) = b_p(i);
bow(x((i+1)*100:(i+2)*100)) = b_p(i);
else
bew(x(i*100:(i+1)*100)) = b_p(i);
bew(x((i+1)*100:(i+2)*100)) = b_p(i);
end
if (mod(n,2)~= 0)
bow(x(n*100:(n+1)*100)) = -1;
bow(x((n+1)*100:(n+2)*100)) = -1;
end
end
end
bw = bw(100:end);
bew = bew(100:(n+1)*100);
bow = bow(200:(n+2)*100);
wot = 2*pi*t*(5/4);
Wt = 2*pi*t/(4*1);
st = bow.*sin(wot+(bew.*bow).*Wt);
subplot(4,1,1)
plot(t,bw)
grid on ; axis([0 n -2 +2])
subplot(4,1,2)
plot(t,bow)
grid on ; axis([0 n -2 +2])
subplot(4,1,3)
plot(t,bew)
grid on ; axis([0 n -2 +2])
subplot(4,1,4)
plot(t,st)
grid on ; axis([0 n -2 +2])
Fs=5/4; %figure
%periodogram(st)
S = fft(st,65);
PSS = S.* conj(S) / 65;
f = 1000*(-16:16)/65;
figure
plot(f,PSS(1:33))

Input and Output of MSK modulation matlab source code

Run the downloaded MSKModulation.m file after unzipping the folder. and provide input as follows.

MSK matlab code input

After the input is given press "ENTER" key, you will get output matlab image as below.

MSK matlab code output

DOWNLOAD MSK matlab code .m file

Download MSKModulation rar file containing matlab file>>.


Useful Links to MATLAB codes

Refer following as well as links mentioned on left side panel for useful MATLAB codes.
OFDM Preamble generation  Time off estimation corr  Freq off estimation corr  channel estimation  11a WLAN channel  PN sequence generation  OFDMA Tx Rx  AES DES  carrier aggregation  CCDF  FIR Filter  IIR Filter  Low Pass FIR  Viterbi decoder  CRC8 CRC32 

RF and Wireless tutorials

WLAN  802.11ac  802.11ad  wimax  Zigbee  z-wave  GSM  LTE  UMTS  Bluetooth  UWB  IoT  satellite  Antenna  RADAR