Skip to main content

MATLAB code for GMSK


 

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

 



















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

People are good at skipping over material they already know!

View Related Topics to







Contact Us

Name

Email *

Message *

Popular Posts

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

📘 Overview of BER and SNR 🧮 Online Simulator for BER calculation of m-ary QAM and m-ary PSK 🧮 MATLAB Code for BER calculation of M-ary QAM, M-ary PSK, QPSK, BPSK, ... 📚 Further Reading 📂 View Other Topics on M-ary QAM, M-ary PSK, QPSK ... 🧮 Online Simulator for Constellation Diagram of m-ary QAM 🧮 Online Simulator for Constellation Diagram of m-ary PSK 🧮 MATLAB Code for BER calculation of ASK, FSK, and PSK 🧮 MATLAB Code for BER calculation of Alamouti Scheme 🧮 Different approaches to calculate BER vs SNR What is Bit Error Rate (BER)? The abbreviation BER stands for Bit Error Rate, which indicates how many corrupted bits are received (after the demodulation process) compared to the total number of bits sent in a communication process. BER = (number of bits received in error) / (total number of tran...

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; num_symbols = 1e5; snr_db = -20:2:20; 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) psk_order = psk_orders(i); for j = 1:length(snr_db) data_symbols = randi([0, psk_order-1], 1, num_symbols); modulated_signal = pskmod(data_symbols, psk_order, pi/psk_order); received_signal = awgn(modulated_signal, snr_db(j), 'measured'); demodulated_symbols = pskdemod(received_signal, psk_order, pi/psk_order); ber_psk_results(i, j) = sum(data_symbols ~= demodulated_symbols) / num_symbols; end end for i...

BER performance of QPSK with BPSK, 4-QAM, 16-QAM, 64-QAM, 256-QAM, etc (MATLAB + Simulator)

📘 Overview 📚 QPSK vs BPSK and QAM: A Comparison of Modulation Schemes in Wireless Communication 📚 Real-World Example 🧮 MATLAB Code 📚 Further Reading   QPSK provides twice the data rate compared to BPSK. However, the bit error rate (BER) is approximately the same as BPSK at low SNR values when gray coding is used. On the other hand, QPSK exhibits similar spectral efficiency to 4-QAM and 16-QAM under low SNR conditions. In very noisy channels, QPSK can sometimes achieve better spectral efficiency than 4-QAM or 16-QAM. In practical wireless communication scenarios, QPSK is commonly used along with QAM techniques, especially where adaptive modulation is applied. Modulation Bits/Symbol Points in Constellation Usage Notes BPSK 1 2 Very robust, used in weak signals QPSK 2 4 Balanced speed & reliability 4-QAM ...

Online Simulator for ASK, FSK, and PSK

Try our new Digital Signal Processing Simulator!   Start Simulator for binary ASK Modulation Message Bits (e.g. 1,0,1,0) Carrier Frequency (Hz) Sampling Frequency (Hz) Run Simulation Simulator for binary FSK Modulation Input Bits (e.g. 1,0,1,0) Freq for '1' (Hz) Freq for '0' (Hz) Sampling Rate (Hz) Visualize FSK Signal Simulator for BPSK Modulation ...

Doppler Delay

  Doppler Shift Formula When either the transmitter or the receiver is in motion, or when both are in motion, Doppler Shift is an essential parameter in wireless Communication. We notice variations in reception frequencies in vehicles, trains, or other similar environments. In plain language, the received signal frequency increases as the receiver moves toward the transmitter and drops as the receiver moves in the opposite direction of the transmitter. This phenomenon is called the Doppler shift or Doppler spread. Doppler Shift Formula: By equation,                fR = fT (+/-) fD                                      fR= receiving  frequency                                      fT= transmitted frequency              ...

Theoretical vs. simulated BER vs. SNR for ASK, FSK, and PSK (MATLAB Code + Simulator)

📘 Overview 🧮 Simulator for calculating BER 🧮 MATLAB Codes for calculating theoretical BER 🧮 MATLAB Codes for calculating simulated BER 📚 Further Reading BER vs. SNR denotes how many bits in error are received for a given signal-to-noise ratio, typically measured in dB. Common noise types in wireless systems: 1. Additive White Gaussian Noise (AWGN) 2. Rayleigh Fading AWGN adds random noise; Rayleigh fading attenuates the signal variably. A good SNR helps reduce these effects. Simulator for calculating BER vs SNR for binary ASK, FSK, and PSK Calculate BER for Binary ASK Modulation Enter SNR (dB): Calculate BER Calculate BER for Binary FSK Modulation Enter SNR (dB): Calculate BER Calculate BER for Binary PSK Modulation Enter SNR (dB): Calculate BER BER vs. SNR Curves MATLAB Code for Theoretical BER % The code is written by SalimWireless.Com clc; clear; close all; % SNR va...

MATLAB Codes for Various types of beamforming | Beam Steering, Digital...

📘 How Beamforming Improves SNR 🧮 MATLAB Code 📚 Further Reading 📂 Other Topics on Beamforming in MATLAB ... MIMO / Massive MIMO Beamforming Techniques Beamforming Techniques MATLAB Codes for Beamforming... How Beamforming Improves SNR The mathematical [↗] and theoretical aspects of beamforming [↗] have already been covered. We'll talk about coding in MATLAB in this tutorial so that you may generate results for different beamforming approaches. Let's go right to the content of the article. In analog beamforming, certain codebooks are employed on the TX and RX sides to select the best beam pairs. Because of their beamforming gains, communication created through the strongest beams from both the TX and RX side enhances spectrum efficiency. Additionally, beamforming gain directly impacts SNR improvement. Wireless communication system capacity = bandwidth*log2(1+SNR)...

MATLAB Code for QPSK Modulation and Demodulation

📘 Overview 🧮 MATLAB Codes 🧮 Theory 🧮 BER performance of QPSK with BPSK, 4-QAM, 16-QAM, 64-QAM, 256-QAM, etc 📚 Further Reading   Quadrature Phase Shift Keying (QPSK) is a digital modulation scheme that conveys two bits per symbol by changing the phase of the carrier signal. Each pair of bits is mapped to one of four possible phase shifts: 0°, 90°, 180°, or 270° 00  ===> 0 degree phase shift of carrier signal 01  ===> 90 degree 11  ===> 180 degree 10  ===> 270 degree   MATLAB Script clc; clear all; close all; clc; M = 4; data = randi([0 (M-1)], 1000, 1); Phase = 0; modData=pskmod(data,M,Phase); figure(1); scatterplot(modData); channelAWGN = 15; rxData2 = awgn(modData, channelAWGN); figure(2); scatterplot(rxData2); demodData = pskdemod(rxData2,M,Phase);   Result data 1 0 2 2 0 2 1 . . . modData -1.00000000000000 + 1.22464679914735e-16i -1.83697019872103e-16 - 1.000000000000...