I am attempting to write a FFSK (differentially encoded MSK) modulator. I have found and implemented a demodulator that works with sample data taken from a radio of a FFSK signal. The demodulator uses a FM Discriminator to transform the IQ data to a FFSK signal that can be decoded. I am using the method described in the article "Minimum Shift Keying: A Spectrally Efficient Modulation" by Subbarayan Pasupathy to modulate a FFSK signal. When a FM Discriminator is applied to the output of the modulator a square wave alternating between +/- 4.5 deg is produced.
Below is a snippet of my matlab code used for modulation:
% differentially encode to produce a 1-to-1 mapping between input bits and output frequency for FFSK diffBits = [bits(1) zeros(1, length(bits) - 1)]; for i=2:length(diffBits) diffBits(i) = xor(diffBits(i - 1), bits(i)); end iBits = diffBits(1:2:end); qBits = diffBits(2:2:end); % rectangular pulses of duration 2*T w/ Q delayed from I by T iPulses = [kron(iBits * 2 - 1, ones(1, 2 * SYMBOL_SAMPLES)) zeros(1, SYMBOL_SAMPLES)]; qPulses = [zeros(1, SYMBOL_SAMPLES) kron(qBits * 2 - 1, ones(1,2 * SYMBOL_SAMPLES))]; t = -T:SAMPLE_PERIOD:(MESSAGE_DURATION - SAMPLE_PERIOD); plotTime = t/T; % baseband symbols (Parallel generation of Type I MSK, see Couch Figure 5-36) iSymbols = iPulses .* cos(pi * t / (2 * T)); qSymbols = qPulses .* sin(pi * t / (2 * T));
Here is a graph of the output of the FM discriminator from the sample data:
Here is a graph of the output of the FM discriminator from the modulator data:
My question is what is different between the real data and my modulator that could produce this different output? I am looking for a way to make my modulator produce data similar to the sample data.
If this helps, here is the FFT of the baseband of the sample data (derotated and resampled down):
% samples are complex int16 values read in from a file num_samples_fft = 4096*2; Fs = 781250; freqOffset = -25200 shifted_samples = samples .* exp(2*j*pi*freqOffset/Fs*(0:length(samples)-1)); resampled_samples = resample(shifted_samples, 96, 3125); resampled_samples_fft = fft(resampled_samples,num_samples_fft); resampled_samples_fft = resampled_samples_fft([num_samples_fft/2+1:end 1:num_samples_fft/2]); figure; plot(f,2*abs(resampled_samples_fft(1:num_samples_fft))); title('Sample Data FFT');
Whereas if I do the same process to data that I modulate this is the resulting FFT graph: