% and finally optional diversity combination and make decn on data and pilot bits
+ tx_pilot_bits = rx_pilot_bits = zeros(Npilotsframe*Nc,1);
for c=1:Nc
for r=1:Nsymbrowpilot
div_symb = rx_symb(r,c);
div_symb += rx_symb(r,c + Nc*d);
end
if r > Npilotsframe
+ % data symbols, ouput of demod
i = (c-1)*Nsymbrow + r - Npilotsframe;
rx_bits((2*(i-1)+1):(2*i)) = qpsk_demod(div_symb);
+ else
+ % demodulated pilot symbols, which we can use to estimate BER
+ %printf("%d %d (%f %f) (%f %f)\n", r, c, real(div_symb), imag(div_symb), real(cohpsk.pilot(r,c)), imag(cohpsk.pilot(r,c)));
+ i = (c-1)*Npilotsframe + r;
+ tx_pilot_bits((2*(i-1)+1):(2*i)) = qpsk_demod(cohpsk.pilot(r,c));
+ rx_pilot_bits((2*(i-1)+1):(2*i)) = qpsk_demod(div_symb);
end
end
end
+ % estimate BER from pilot bits
+
+ cohpsk.npilotbits += Npilotsframe*Nc;
+ nerr = sum(xor(tx_pilot_bits, rx_pilot_bits));
+ cohpsk.npilotbiterrors += nerr;
+
% Estimate noise power from demodulated symbols. One method is to
% calculate the distance of each symbol from the average symbol
% position. However this is complicated by fading, which means the
acohpsk = symbol_rate_init(acohpsk);
acohpsk.Ndft = 1024;
acohpsk.f_est = afdmdv.Fcentre;
+acohpsk.npilotbits = 0;
+acohpsk.npilotbiterrors = 0;
ch_fdm_frame_buf = zeros(1, Nsw*acohpsk.Nsymbrowpilot*afdmdv.M);
% if we are in sync complete demodulation with symbol rate processing
if (next_sync == 1) || (sync == 1)
- [rx_symb rx_bits rx_symb_linear amp_ phi_ sig_rms noise_rms] = qpsk_symbols_to_bits(acohpsk, acohpsk.ct_symb_ff_buf);
+ [rx_symb rx_bits rx_symb_linear amp_ phi_ sig_rms noise_rms acohpsk] = qpsk_symbols_to_bits(acohpsk, acohpsk.ct_symb_ff_buf);
rx_symb_log = [rx_symb_log; rx_symb];
rx_amp_log = [rx_amp_log; amp_];
rx_phi_log = [rx_phi_log; phi_];
end
ber = Nerrs/Tbits;
-printf("\nOctave EsNodB: %4.1f ber..: %4.3f Nerrs..: %d Tbits..: %d\n", EsNodB, ber, Nerrs, Tbits);
+printf("\nOctave EsNodB: %4.1f BER......: %4.3f Nerrs..: %d Tbits..: %d\n", EsNodB, ber, Nerrs, Tbits);
+pilot_ber = acohpsk.npilotbiterrors/acohpsk.npilotbits;
+printf(" Pilot BER: %4.3f Nerrs..: %d Tbits..: %d\n", pilot_ber, acohpsk.npilotbiterrors, acohpsk.npilotbits);
if compare_with_c