1% fsk_lib_ldpc.m 2% 3% Library of common functions used for LDPC coded 4FSK modem experiments 4 5fsk_lib; 6ldpc; 7 8% set up modem waveform, real signal that an pass through a SSB radio 9function [states M] = modem_init(Rs,Fs,df) 10 M = 4; 11 if Rs == 100 P=8; end 12 if Rs == 400 P=10; end; 13 states = fsk_init(Fs,Rs,M,P=10,nsym=100); 14 states.tx_real = 1; 15 states.tx_tone_separation = Rs; 16 if Rs == 100 17 states.ftx = 1500 -2.5*states.tx_tone_separation + states.tx_tone_separation*(1:M); 18 elseif Rs == 400 19 states.ftx = 600 + states.tx_tone_separation*(0:M-1); 20 else 21 disp("unknown symbol rate"); 22 end 23 states.fest_fmin = 500; 24 states.fest_fmax = 2500; 25 states.fest_min_spacing = Rs/2; 26 states.df = df; 27 28 states.ber_valid_thresh = 0.1; 29 states.ber_invalid_thresh = 0.2; 30 31 states.amp_scale = 1000; 32end 33 34% set up modem waveform and LPC code 35function [states code_param] = fsk_lib_ldpc_init (HRA, Rs, Fs, df=0, plots=0) 36 [states M] = modem_init(Rs, Fs, df); 37 N = states.N; 38 if plots; states.verbose = 0x4; end 39 40 Hsize=size(HRA); 41 states.rate = (Hsize(2)-Hsize(1))/Hsize(2); 42 code_param = ldpc_init_user(HRA, modulation='FSK', mod_order=states.M, mapping='gray'); 43 states.coden = code_param.coded_bits_per_frame; 44 states.codek = code_param.data_bits_per_frame; 45end 46