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) Simulato...

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...

UGC NET Electronic Science Previous Year Question Papers

Home / Engineering & Other Exams / UGC NET 2022 PYQ ⬇️ Download Papers and Solutions 📋 Exam Pattern 💡 Preparation Tips ❓ FAQs 📥 Download UGC NET Electronics PDFs Complete collection of previous year question papers, answer keys and explanations for Subject Code 88. Start Downloading UGC-NET (Electronics Science, Subject code: 88) Subject_Code : 88; Department : Electronic Science; 📂 View All Question Papers Q. UGC Net Electronic Science Question Paper [June 2025] A. UGC Net Electronic Science Question Paper With Answer Key Download Pdf [June 2025] with full explanation Q. UGC Net Electronic Science Question Paper [December 2024] A. UGC Net Electronic Science Question Paper With Answer Key Download Pdf [December 2024] ...

MATLAB code for BER vs SNR for M-QAM, M-PSK, QPSk, BPSK, ...(with Online Simulator)

🧮 MATLAB Code for BPSK, M-ary PSK, and M-ary QAM Together 🧮 MATLAB Code for M-ary QAM 🧮 MATLAB Code for M-ary PSK 📚 Further Reading MATLAB Script for BER vs. SNR for M-QAM, M-PSK, QPSK, BPSK % Written by Salim Wireless clc; clear; close all; snr_db = -5:2:25; psk_orders = [2, 4, 8, 16, 32]; qam_orders = [4, 16, 64, 256]; ber_psk_results = zeros(length(psk_orders), length(snr_db)); ber_qam_results = zeros(length(qam_orders), length(snr_db)); for i = 1:length(psk_orders) ber_psk_results(i, :) = berawgn(snr_db, 'psk', psk_orders(i), 'nondiff'); end for i = 1:length(qam_orders) ber_qam_results(i, :) = berawgn(snr_db, 'qam', qam_orders(i)); end figure; semilogy(snr_db, ber_psk_results(1, :), 'o-', 'LineWidth', 1.5, 'DisplayName', 'BPSK'); hold on; for i = 2:length(psk_orders) semilogy(snr_db, ber_psk_results(i, :), 'o-', 'DisplayName', sprintf('%d-PSK', psk_or...

Constellation Diagrams of ASK, PSK, and FSK (with MATLAB Code + Simulator)

Constellation Diagrams: ASK, FSK, and PSK Comprehensive guide to signal space representation, including interactive simulators and MATLAB implementations. 📘 Overview 🧮 Simulator ⚖️ Theory 📚 Resources Definitions Constellation Tool Key Points MATLAB Code 📂 Other Topics: M-ary PSK & QAM Diagrams ▼ 🧮 Simulator for M-ary PSK Constellation 🧮 Simulator for M-ary QAM Constellation BASK (Binary ASK) Modulation Transmits one of two signals: 0 or -√Eb, where Eb​ is the energy per bit. These signals represent binary 0 and 1. BFSK (Binary FSK) Modulation Transmits one...

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...

OFDM Symbols and Subcarriers Explained

This article explains how OFDM (Orthogonal Frequency Division Multiplexing) symbols and subcarriers work. It covers modulation, mapping symbols to subcarriers, subcarrier frequency spacing, IFFT synthesis, cyclic prefix, and transmission. Step 1: Modulation First, modulate the input bitstream. For example, with 16-QAM , each group of 4 bits maps to one QAM symbol. Suppose we generate a sequence of QAM symbols: s0, s1, s2, s3, s4, s5, …, s63 Step 2: Mapping Symbols to Subcarriers Assume N sub = 8 subcarriers. Each OFDM symbol in the frequency domain contains 8 QAM symbols (one per subcarrier): Mapping (example) OFDM symbol 1 → s0, s1, s2, s3, s4, s5, s6, s7 OFDM symbol 2 → s8, s9, s10, s11, s12, s13, s14, s15 … OFDM sym...

MIMO, massive MIMO, and Beamforming

Introduction to MIMO Systems The term Multiple Input Multiple Output (MIMO) refers to wireless communication systems that use multiple antennas at both the transmitter (Tx) and receiver (Rx). MIMO is a core technology in modern standards such as Wi-Fi 4/5/6, LTE, and 5G . The main purpose of MIMO is to increase channel capacity and improve link reliability by transmitting multiple independent data streams over the same frequency band. These simultaneous data streams are spatially multiplexed and transmitted through distinct propagation paths. When properly decoded, this orthogonal multiplexing minimizes interference among data streams and enhances throughput. In Massive MIMO —a key concept in 5G systems—hundreds of antennas are used at the base station to achieve very high capacity and to enable beamforming or directional transmission. 1. Essential Characteristics of a MIMO System 1.1 Spatial Division Multiple Access (SD...