Spectral Estimation of MSK vs GMSK Modulation MATLAB Code % The code is developed by SalimWireless.com clc; clear; close all; % Parameters Nbits = 2000; % Number of bits Rb = 1000; % Bit rate (bps) Fs = 10*Rb; % Sampling frequency (Hz) Ts = 1/Fs; % Sampling interval T = 1/Rb; % Bit duration SamplesPerSymbol = Fs/Rb; % Number of samples per bit % Generate random bit sequence data = randi([0 1], 1, Nbits); % Create the baseband message signal (upsampled bits) message_signal = zeros(1, Nbits * SamplesPerSymbol); for i = 1:Nbits message_signal((i-1)*SamplesPerSymbol + 1 : i*SamplesPerSymbol) = data(i); end t_message = (0:length(message_signal)-1)*Ts; % MSK Modulation mskMod = comm.MSKModulator('BitInput', true, 'SamplesPerSymbol', SamplesPerSymbol); mskSig = step(mskMod, data.'); % GMSK Modulation BT = 0.3; % Gaussian BT product gmskMod = comm.GMSKModulator('BitInput', true, 'BandwidthTimeProduct', BT, 'SamplesPerSymbol', SamplesPerSymbol); gmskSig = step(gmskMod, data.'); % PSD estimation using pwelch (absolute frequency in Hz) [psdMSK,f] = pwelch(mskSig, hamming(512), 256, 1024, Fs, 'centered'); [psdGMSK,~] = pwelch(gmskSig, hamming(512), 256, 1024, Fs, 'centered'); % Plot signals (time domain) t = (0:length(mskSig)-1)/Fs; figure; % Plot Original Message Signal subplot(3,1,1); stairs(t_message(1:200), message_signal(1:200), 'k', 'LineWidth', 1.5); ylim([-0.2 1.2]); xlabel('Time (s)'); ylabel('Bit Value'); title('Original Message Signal (First 20 bits)'); grid on; % Plot MSK and GMSK Signals subplot(3,1,2); plot(t(1:200), real(mskSig(1:200)),'b'); hold on; plot(t(1:200), real(gmskSig(1:200)),'r'); xlabel('Time (s)'); ylabel('Amplitude'); legend('MSK','GMSK'); title('MSK and GMSK Signals (time domain)'); grid on; % Plot spectra (frequency domain, in Hz) subplot(3,1,3); plot(f, 10*log10(psdMSK/max(psdMSK)), 'b','LineWidth',1.5); hold on; plot(f, 10*log10(psdGMSK/max(psdGMSK)), 'r','LineWidth',1.5); xlabel('Frequency (Hz)'); ylabel('Normalized PSD (dB)'); legend('MSK','GMSK'); title('MSK vs GMSK Spectrum (absolute frequency in Hz)'); grid on; web('https://www.salimwireless.com/search?q=msk%20gmsk', '-browser'); Output Further Reading Parent Topics MATLAB Modulation MSK GMSK Spectral density estimation