rand('seed',1);
states.pilots = 1 - 2*(rand(1,Nc+2) > 0.5);
-
+
% carrier tables for up and down conversion
fcentre = 1500;
Npsam = length(states.rate_fs_pilot_samples);
states.timing_norm = Npsam*(states.rate_fs_pilot_samples * states.rate_fs_pilot_samples');
% printf("timing_norm: %f\n", states.timing_norm)
+
+ % sync state machine
+ states.sync_state = states.last_sync_state = 'searching';
+ states.uw_errors = 0;
+ states.sync_counter = 0;
+ states.sync_frame_count = 0;
+ states.sync_start = 0;
+ states.sync_end = 0;
+
% LDPC code is optionally enabled
states.rate = 1.0;
function test_bits_ofdm_file
- 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;
rand('seed',1);
test_bits_ofdm = round(rand(1,Nbitsperframe));
-
+ test_bits_ofdm(1:states.uw_len) = 0; % insert Unique Word
+ printf("%d test bits\n", Nbitsperframe);
+
f=fopen("../src/test_bits_ofdm.h","wt");
fprintf(f,"/* Generated by test_bits_ofdm_file() Octave function */\n\n");
fprintf(f,"const int test_bits_ofdm[]={\n");
nin = Nsamperframe+2*(M+Ncp);
%states.rxbuf(Nrxbuf-nin+1:Nrxbuf) = rx(prx:nin);
%prx += nin;
-
- states.sync_state = states.last_sync_state = 'searching';
- states.uw_errors = 0;
- states.sync_counter = 0;
- states.sync_frame_count = 0;
- states.sync_start = 0;
- states.sync_end = 0;
states.verbose = 1;
Ndiscard = 20;
if frame_count > Ndiscard
- Terrs -= sum(Nerrs_log(1:Ndiscard)); Tbits -= Ndiscard;
+ Terrs -= sum(Nerrs_log(1:Ndiscard)); Tbits -= Ndiscard*Nbitsperframe;
printf("BER2.: %5.4f Tbits: %5d Terrs: %5d\n", Terrs/Tbits, Tbits, Terrs);
end