refactored Octave to get consistent variable names
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Thu, 12 Apr 2018 09:44:56 +0000 (09:44 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Thu, 12 Apr 2018 09:44:56 +0000 (09:44 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@3470 01035d8c-6547-0410-b346-abe4f91aad63

codec2-dev/octave/ofdm_ldpc_tx.m
codec2-dev/octave/ofdm_lib.m
codec2-dev/octave/ofdm_load_const.m
codec2-dev/octave/ofdm_rx.m
codec2-dev/octave/ofdm_tx.m
codec2-dev/octave/tofdm.m

index aaddb7f9dd158851bf5ae07a5c65b415004dadd8..187b21cdb99eab1572e534b634a0de3e24c84fda 100644 (file)
@@ -39,7 +39,7 @@ function ofdm_ldpc_tx(filename, Nsec, interleave_frames = 1, EbNodB=100, channel
 
   % init modem
 
-  Ts = 0.018; Tcp = 0.002; Rs = 1/Ts; bps = 2; Nc = 16; Ns = 8;
+  Ts = 0.018; Tcp = 0.002; Rs = 1/Ts; bps = 2; Nc = 17; Ns = 8;
   states = ofdm_init(bps, Rs, Tcp, Ns, Nc);
   ofdm_load_const;
 
@@ -50,7 +50,7 @@ function ofdm_ldpc_tx(filename, Nsec, interleave_frames = 1, EbNodB=100, channel
   init_cml('/home/david/Desktop/cml/');
   load HRA_112_112.txt
   [code_param framesize rate] = ldpc_init_user(HRA_112_112, modulation, mod_order, mapping);
-  assert(Nbitsperframe == code_param.code_bits_per_frame);
+  assert(Nbitsperframe == (code_param.code_bits_per_frame + Nuwbits + Ntxtbits));
 
   % Generate fixed test frame of tx bits and run OFDM modulator
 
index a853946acaafd4e0089a4a687becaeb03b48f6da..0b2921b90689eacc7fb32aad1c0cf1c0e4f61df2 100644 (file)
@@ -136,8 +136,8 @@ function states = ofdm_init(bps, Rs, Tcp, Ns, Nc)
   states.Nbitsperframe = (Ns-1)*Nc*bps;
   states.Nrowsperframe = states.Nbitsperframe/(Nc*bps);
   states.Nsamperframe =  (states.Nrowsperframe+1)*(states.M+states.Ncp);
-  states.txt_len = 4;   % reserve 4 bits/frame for auxillary text information
-  states.uw_len = (Ns-1)*bps - states.txt_len;
+  states.Ntxtbits = 4;   % reserve 4 bits/frame for auxillary text information
+  states.Nuwbits  = (Ns-1)*bps - states.Ntxtbits;
 
   % generate same pilots each time
 
@@ -524,7 +524,7 @@ function test_bits_ofdm_file
 
   rand('seed',1);
   test_bits_ofdm = round(rand(1,Nbitsperframe));
-  test_bits_ofdm(1:states.uw_len) = 0;  % insert Unique Word
+  test_bits_ofdm(1:states.Ntxtbits) = 0;  % insert Unique Word
   printf("%d test bits\n", Nbitsperframe);
   
   f=fopen("../src/test_bits_ofdm.h","wt");
index 70459ddbc556e299e68d112c079562dded39fd6d..e4b87746606a2920aafb0632c906540bcefc051f 100644 (file)
@@ -13,6 +13,8 @@ Nbitsperframe = states.Nbitsperframe;
 Nrowsperframe = states.Nrowsperframe;
 Nsamperframe = states.Nsamperframe;
 timing_mx_thresh = 0.3;
+Nuwbits = states.Nuwbits;
+Ntxtbits = states.Ntxtbits;
 
 W = states.W;
 w = states.w;
index b8ee9dd171e31c188eb3c991b1d885973b58a467..8ef93ce0a11ff0ff81991ce444d37ae717cf7ae0 100644 (file)
@@ -27,7 +27,7 @@ function ofdm_rx(filename, error_pattern_filename)
 
   rand('seed', 1);
   tx_bits = round(rand(1,Nbitsperframe));
-  tx_bits(1:states.uw_len) = 0;   % insert UW
+  tx_bits(1:states.Nuwbits) = 0;   % insert UW
  
   % init logs and BER stats
 
@@ -47,7 +47,7 @@ function ofdm_rx(filename, error_pattern_filename)
   
   states.verbose = 1;
 
-  Nerrs = 0; rx_uw = zeros(1,states.uw_len);
+  Nerrs = 0; rx_uw = zeros(1,states.Nuwbits);
   
   % main loop ----------------------------------------------------------------
 
@@ -71,7 +71,7 @@ function ofdm_rx(filename, error_pattern_filename)
     
     if strcmp(states.sync_state,'synced') || strcmp(states.sync_state,'trial_sync')
       [rx_bits states aphase_est_pilot_log arx_np arx_amp] = ofdm_demod(states, rxbuf_in);
-      rx_uw = rx_bits(1:states.uw_len);
+      rx_uw = rx_bits(1:states.Nuwbits);
       
       errors = xor(tx_bits, rx_bits);
       Nerrs = sum(errors);
index 10a167dbd0a76738461e12ccb71de86bdb22a009..371922a574621f675b9ebcbeb325732bbde0b886 100644 (file)
@@ -32,7 +32,7 @@ function ofdm_tx(filename, Nsec, EbNodB=100, channel='awgn', freq_offset_Hz=0, d
   Nframes = floor((Nrows-1)/Ns);
   rand('seed', 1);
   tx_bits = round(rand(1,Nbitsperframe));
-  tx_bits(1:states.uw_len) = 0; % insert UW
+  tx_bits(1:states.Nuwbits) = 0; % insert UW
   
   tx = [];
   for f=1:Nframes
index 85e4d44cd044f1763e0dc62b58865b5175ed4861..7e9eb586021daa636619a9a5fcda8d12cb33d95d 100644 (file)
@@ -24,7 +24,7 @@ ofdm_load_const;
 
 rand('seed',1);
 tx_bits = round(rand(1,Nbitsperframe));
-tx_bits(1:states.uw_len) = 0;
+tx_bits(1:states.Nuwbits) = 0;
 
 % Run tx loop