From f42762597b16ec50c3d0c8ebf72a1929de5abbf0 Mon Sep 17 00:00:00 2001 From: baobrien Date: Sat, 10 Oct 2015 18:08:24 +0000 Subject: [PATCH] A little improvement to 4FSK symbol resolution git-svn-id: https://svn.code.sf.net/p/freetel/code@2426 01035d8c-6547-0410-b346-abe4f91aad63 --- codec2-dev/octave/fsk4.m | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/codec2-dev/octave/fsk4.m b/codec2-dev/octave/fsk4.m index d8b90b4b..03c654f4 100644 --- a/codec2-dev/octave/fsk4.m +++ b/codec2-dev/octave/fsk4.m @@ -154,11 +154,13 @@ endfunction %incoherent demod loosly based on another paper. Works, more or less. % Paper is titled "Design and Implementation of a Fully Digital 4FSK Demodulator" function [bits err] = fsk4_demod_fmrid(fsk4_states, rx) + rxd = analog_fm_demod(fsk4_states.fm_states,rx); + M = fsk4_states.M; - fine_timing = 10; fine_timing = 51; + %RRC filter to get rid of some of the noise rxd = filter(fsk4_states.rx_filter, 1, rxd); sym = rxd(fine_timing:M:length(rxd)); @@ -168,11 +170,21 @@ function [bits err] = fsk4_demod_fmrid(fsk4_states, rx) %eyediagram(afsym,2); % Demod symbol map. I should probably figure a better way to do this. % After sampling, the furthest symbols tend to be distributed about .80 - dmsyms = rot90(fsk4_states.symmap*.80) + + % A little cheating to demap the symbols + % Take a histogram of the sampled symbols, find the center of the largest distribution, + % and correct the symbol map to match it + [a b] = hist(sym,50) + [a ii] = max(a) + grmax = abs(b(ii)) + grmax = (grmax<.65)*.65 + (grmax>=.65)*grmax + + dmsyms = rot90(fsk4_states.symmap*grmax) figure(2) hist(sym,200); + %demap the symbols [err, symout] = min(abs(sym-dmsyms)); bits = zeros(1,length(symout)*2); -- 2.25.1