Skip to main content

MATLAB code for GMSK


GMSK Modulation and Demodulation in MATLAB: A Complete Guide

Gaussian Minimum Shift Keying (GMSK) is a continuous-phase frequency shift keying modulation scheme. It is widely used in GSM (Global System for Mobile Communications) because of its excellent spectral efficiency and constant envelope properties. This MATLAB implementation covers the full signal chain, from Gaussian filtering to noiseless demodulation.

 

Copy the MATLAB code from here 

MATLAB Code 

clc; clear; close all;

% Parameters
samples_per_bit = 36; bit_duration = 1; num_bits = 20;
sample_interval = bit_duration / samples_per_bit;
time_vector = 0:sample_interval:(num_bits * bit_duration);
time_vector(end) = [];

% Generate and modulate binary data
binary_data = randi([0, 1], 1, num_bits);
modulated_bits = 2 * binary_data - 1;
upsampled_signal = kron(modulated_bits, ones(1, samples_per_bit));
figure; plot(time_vector, upsampled_signal); title('Message Signal');

% Apply Gaussian filter
filtered_signal = conv(GMSK_gaussian_filter1(bit_duration, samples_per_bit), upsampled_signal);
filtered_signal = [filtered_signal, filtered_signal(end)];
figure; plot(filtered_signal); title('Filtered Signal');

% Integration & GMSK modulation
integrated_signal = cumsum(filtered_signal);
gmsk_signal = exp(1i * integrated_signal);

% Plotting the real and imaginary parts of the GMSK signal with labels
figure;
plot(real(gmsk_signal), 'b'); % Plot real part in blue
hold on;
plot(imag(gmsk_signal), 'r'); % Plot imaginary part in red
title('GMSK Modulated Signal');
xlabel('Samples');
ylabel('Amplitude');
legend('Real Part', 'Imaginary Part'); % Adding labels to the legend


% Noiseless demodulation & matched filtering
matched_filter = GMSK_matched_filter(bit_duration, 7);
filt_signal = conv(matched_filter, gmsk_signal);
filt_signal = [filt_signal, filt_signal(end)];

% Extract phase, differentiate & downsample
phase_derivative = [unwrap(angle(filt_signal(1))), diff(unwrap(angle(filt_signal)))];
downsampled_signal = GMSK_downsample(70, 71, samples_per_bit, phase_derivative);
digital_output = GMSK_ADC(downsampled_signal);

% Plot demodulated signal
rect_pulses = repelem(digital_output, samples_per_bit);
time_axis = 0:1/samples_per_bit:length(digital_output);
figure; plot(time_axis(1:end-1), rect_pulses); title('Demodulated Signal');

% Functions
function h = GMSK_gaussian_filter1(T, sps)
t = (-1.5*T:T/sps:1.5*T); BT = 0.3;
h = BT * sqrt((2*pi) / log(2)) .* exp(-(((2 * pi^2) * (BT^2)) .* t.^2) / log(2));
h = (pi / (2 * sum(h))) * h / sqrt(sum(h));
end

function h = GMSK_matched_filter(T, sps)
t = (-1.5*T:T/sps:1.5*T); BT = 0.75;
h = BT * sqrt((2*pi) / log(2)) .* exp(-(((2 * pi^2) * (BT^2)) .* t.^2) / log(2));
h = (pi / (2 * sum(h))) * h / sqrt(sum(h));
end

function downsampled_output = GMSK_downsample(start_idx, end_idx, sps, input_signal)
downsampled_output = input_signal(start_idx:sps:end-end_idx);
end

function quantized_signal = GMSK_ADC(input_signal)
quantized_signal = sign(input_signal);
end

Output

 



















GMSK Simulation Parameters

Parameter Description Typical Value
BT (Bandwidth-Time) Controls the Gaussian filter bandwidth. A lower BT reduces sidebands but increases ISI. 0.3 (GSM Standard)
Samples per Bit Number of digital samples representing a single bit duration. 36 - 64
Gaussian Filter Smoothes the phase transitions to limit the signal spectrum. Implemented via conv()

How the GMSK Code Works

The implementation follows these four critical steps in digital signal processing:

  1. Bit Generation: Random binary data is created and converted to bipolar pulses (+1 and -1).
  2. Gaussian Filtering: The signal passes through a Gaussian pulse-shaping filter. This is the "G" in GMSK, which reduces the bandwidth occupancy compared to standard MSK.
  3. Phase Integration: Since GMSK is a phase-modulation technique, the filtered signal is integrated (using cumsum) to ensure phase continuity.
  4. Matched Filtering & ADC: The receiver uses a matched filter to maximize the Signal-to-Noise Ratio (SNR) before converting the samples back into binary data.

Why choose GMSK over MSK?

  • Spectral Efficiency: GMSK has much narrower main lobes and faster roll-off in the power spectral density.
  • Constant Envelope: It allows power amplifiers to operate in saturation, which is highly power-efficient for mobile devices.
  • Trade-off: The main disadvantage is Inter-Symbol Interference (ISI) introduced by the Gaussian filter if the BT product is too low.

Frequently Asked Questions

Q1: What is the significance of the BT=0.3 in GMSK?
A: BT=0.3 is the standard for GSM cellular networks. it provides the best balance between spectral efficiency and manageable ISI.

Q2: Can this code be used for BER (Bit Error Rate) analysis?
A: Yes, you can wrap the modulation code in a loop and add awgn() noise to create a BER vs. Eb/No curve.

Further Reading

  1. Minimum Shift Keying (MSK) 
  2. MATLAB Code for MSK
  3. Gaussian Minimum Shift Keying (GMSK) 
  4. Gaussian Minimmum Shift Keying (GMSK) Simulator
  5. Difference Between MSK and GMSK

Contact Us

Name

Email *

Message *

Popular Posts

Online Simulator for ASK, FSK, and PSK

Interactive Digital Signal Processing (DSP) Tutorial and Simulator for ASK, FSK, and BPSK modulation techniques. Try our new Digital Signal Processing Simulator!   •   Interactive ASK, FSK, and BPSK tools updated for 2025. Start Now Digital Modulation Visualizer: ASK, FSK, & BPSK Simulator Learn and visualize binary modulation techniques (ASK, FSK, BPSK) in real-time with adjustable carrier and sampling parameters. Perfect for DSP students and engineers. 📡 ASK Simulator 📶 FSK Simulator 🎚️ BPSK Simulator 📚 More Topics ASK Modulator FSK Modulator BPSK Modulator More Topics 1. ASK (Amplitude Shift Keying) Simulat...

BER vs SNR for M-ary QAM, M-ary PSK, QPSK, BPSK, ...(MATLAB Code + Simulator)

Bit Error Rate (BER) & SNR Guide Analyze communication system performance with our interactive simulators and MATLAB tools. 📘 Theory 🧮 Simulators 💻 MATLAB Code 📚 Resources BER Definition SNR Formula BER Calculator MATLAB Comparison 📂 Explore M-ary QAM, PSK, and QPSK Topics ▼ 🧮 Constellation Simulator: M-ary QAM 🧮 Constellation Simulator: M-ary PSK 🧮 BER calculation for ASK, FSK, and PSK 🧮 Approaches to BER vs SNR What is Bit Error Rate (BER)? The BER indicates how many corrupted bits are received compared to the total number of bits sent. It is the primary figure of merit f...

Q-function in BER vs SNR Calculation

Q-function in BER vs. SNR Calculation | Interactive Guide Q-function in BER vs. SNR Calculation In digital communications and signal processing, the Q-function plays a significant role in predicting system reliability. It allows engineers to quantify the probability that Gaussian noise will exceed a specific threshold, causing a bit error. What is the Q-function? The Q-function is a mathematical function representing the tail probability of the standard normal (Gaussian) distribution. It is the complementary cumulative distribution function (CCDF) of a standard Gaussian distribution. Q(x) = (1 / √(2Ï€)) ∫â‚“∞ e^(-t² / 2) dt Q-Function Interactive Simulator Move the slider to see how the "Tail Probability" (the area in red) changes. This area represents the Probability of Error (BER) . Threshold Distance ( x ) — (Simulates Increasing SNR) ...

UGC NET Electronic Science Previous Year Question Papers with Solutions

Home / Engineering & Other Exams / UGC NET 2026 PYQ ⬇️ Download Papers and Solutions 📋 Exam Pattern 💡 Preparation Tips ❓ FAQs 📊 Exam Highlights: Electronic Science (88) Feature Details Junior Research Fellowship (JRF) ₹37,000 + HRA per month Eligibility M.Sc/M.Tech in Electronics (55%) Validity of Certificate JRF (3 Years) | Lectureship (Lifetime) 📥 Download UGC NET Electronics PDFs Complete collection of previous year question papers, answer keys and explanations for Subject Code 88. Start Downloading 📂 View All Question Papers June 2025 - Question Paper Download PDF June 2025 - Solved Paper + Explanation ...

MATLAB Code for ASK, FSK, and PSK (with Online Simulator)

MATLAB Code for ASK, FSK, and PSK Comprehensive implementation of digital modulation and demodulation techniques with simulation results. 📘 Theory 📡 ASK Code 📶 FSK Code 🎚️ PSK Code 🕹️ Simulator 📚 Further Reading Amplitude Shift Frequency Shift Phase Shift Live Simulator ASK, FSK & PSK HomePage MATLAB Code MATLAB Code for ASK Modulation and Demodulation COPY % The code is written by SalimWireless.Com clc; clear all; close all; % Parameters Tb = 1; fc = 10; N_bits = 10; Fs = 100 * fc; Ts = 1/Fs; samples_per_bit = Fs * Tb; rng(10); binar...

DFTs-OFDM vs OFDM: Why DFT-Spread OFDM Reduces PAPR Effectively (with MATLAB Code)

Understanding PAPR in DFT-spread OFDM vs. Standard OFDM In modern wireless communications like 4G LTE and 5G NR, managing the Peak-to-Average Power Ratio (PAPR) is critical for hardware efficiency. While OFDM is the gold standard for high-speed data, its high PAPR poses significant challenges for mobile devices. This is where DFTs-OFDM (also known as SC-FDMA) comes in. DFT-spread OFDM (DFTs-OFDM) has lower Peak-to-Average Power Ratio (PAPR) because it "spreads" the data in the frequency domain before applying IFFT, making the time-domain signal behave more like a single-carrier signal rather than a multi-carrier one like OFDM. Deeper Explanation: Aspect OFDM DFTs-OFDM Signal Type Multi-carrier Single-carrier-like Process IFFT of QAM directly QAM → DFT → IFFT PAPR Level High (due to many...

High Level and Low Level Modulation

📘 Overview 📚 Low Level Modulation 📚 High Level Modulation 📚 Simulator for High and Low Level Modulations 📚 MATLAB Code 📚 Further Reading High Level and Low Level Modulation You know for wireless communication is suitable for long distance communication. In wireless, for data transmission modulation become essential to avoid interference and to reduce antenna size significantly. Especially, in modulation process, we translate the low frequency baseband signal to higher frequency by modulating with high frequency carrier signal. For a typical communication system we generate the high frequency (carrier) signal by using local oscillator. Source signal or message signal is modulated with local oscillator. Then modulated signal is transmitted thru antenna.  Low Level Modulation In low-level modulation , the message signal is modulated with the carrier signal (from the local oscillator) at low power levels . After modulation, the signal is th...

Comparisons among ASK, PSK, and FSK (with MATLAB + Simulator)

Modulation ASK, FSK & PSK Constellation MATLAB Simulink MATLAB Code Comparisons among ASK, PSK, and FSK 📘 Comparisons among ASK, FSK, and PSK 🧮 Online Simulator Bandwidth 🧮 MATLAB Code BER Analysis 📚 Further Reading 📂 View Other Topics on Comparisons among ASK, PSK, and FSK ... 🧮 Comparisons of Noise Sensitivity, Bandwidth, Complexity, etc. 🧮 MATLAB Code for Constellation Diagrams of ASK, FSK, and PSK 🧮 Online Simulator for ASK, FSK, and PSK Generation 🧮 Online Simulator for ASK, FSK, and PSK Constellation 🧮 Some Questions and Answers Comparisons among ASK, PSK, and FSK Comparison among ASK, FSK, and PSK Parameters ASK FSK PSK Variable Characteristics Amplitude ...