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:
- Bit Generation: Random binary data is created and converted to bipolar pulses (+1 and -1).
- 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.
- Phase Integration: Since GMSK is a phase-modulation technique, the filtered signal is integrated (using
cumsum) to ensure phase continuity. - 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.



