rewrote test bits generation
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Mon, 12 Jun 2017 01:38:40 +0000 (01:38 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Mon, 12 Jun 2017 01:38:40 +0000 (01:38 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@3179 01035d8c-6547-0410-b346-abe4f91aad63

codec2-dev/octave/ofdm_dev.m
codec2-dev/octave/ofdm_lib.m
codec2-dev/octave/tofdm.m

index f6cd831a3f4426e673dde744ebea99cc5b16a03c..f66e08cbbbef1d24a97f3275dbad36d03296a22a 100644 (file)
@@ -183,7 +183,6 @@ function [sim_out rx states] = run_sim(sim_in)
     % note for reasons unknown LdpcEncode() returns garbage if we use > 0.5 rather than round()
 
     tx_data_bits = round(rand(1,Nbits*rate));
-    %test_bits_ofdm_file(tx_data_bits);
 
     tx_bits = []; tx_symbols = [];
     for f=1:Nframes
index ef09b6a2f0b006e062429231b9ec8bb9cff27c8e..54393e85d98f27785a806fc82ba02b4b0907135c 100644 (file)
@@ -414,8 +414,19 @@ endfunction
 
 
 % Save test bits frame to a text file in the form of a C array
+% 
+% usage:
+%   ofdm_lib; test_bits_ofdm_file
+%
 
-function test_bits_ofdm_file(test_bits_ofdm)
+function test_bits_ofdm_file
+
+  Ts = 0.018; Tcp = 0.002; Rs = 1/Ts; bps = 2; Nc = 16; Ns = 8;
+  states = ofdm_init(bps, Rs, Tcp, Ns, Nc);
+  ofdm_load_const;
+
+  rand('seed',1);
+  test_bits_ofdm = round(rand(1,Nbitsperframe));
 
   f=fopen("../src/test_bits_ofdm.h","wt");
   fprintf(f,"/* Generated by test_bits_ofdm_file() Octave function */\n\n");
index 1dc88d0a2bc74afb9bb040a82319eb725955c5ec..4816ca1cd0bee692c048dafcf4d04ab4eb87d5f4 100644 (file)
@@ -3,7 +3,8 @@
 %
 % Octave script for comparing Octave and C versions of OFDZM modem
 
-Frames = 10;
+
+Frames = 1;
 
 more off;
 ofdm_lib;
@@ -12,7 +13,7 @@ autotest;
 % Run a few frames of Octave version
 
 Ts = 0.018; Tcp = 0.002; Rs = 1/Ts; bps = 2; Nc = 16; Ns = 8;
-states = ofdm_initbps, Rs, Tcp, Ns, Nc);
+states = ofdm_init(bps, Rs, Tcp, Ns, Nc);
 ofdm_load_const;
 
 rand('seed',1);
@@ -20,13 +21,14 @@ tx_bits = round(rand(1,Nbitsperframe));
 
 tx_bits_log = []; tx_log = [];
 for f=1:Frames
-  tx_bits_log = [tx_bits tx_bits];
+  tx_bits_log = [tx_bits_log tx_bits];
   tx_log = [tx_log ofdm_mod(states, tx_bits)];
 end
-% Load C version and plot Octave and C states and differences -----------------------------
 
-load ../build_linux/octave/tofdm_out.txt;
+% Run C version and plot Octave and C states and differences -----------------------------
+
+system('../build_linux/unittest/tofdm');
+load tofdm_out.txt;
 
 stem_sig_and_error(1, 111, tx_bits_log_c, tx_bits_log - tx_bits_log_c, 'tx bits', [1 length(tx_bits_log) -1.5 1.5])
 stem_sig_and_error(2, 211, real(tx_log_c), real(tx_log - tx_log_c), 'tx re', [1 length(tx_log_c) -1.5 1.5])