% lines at +/- Rs/2
if pilot_bit
- tx_symbols(Nc+1) = -prev_tx_symbols(c+1);
+ tx_symbols(Nc+1) = -prev_tx_symbols(Nc+1);
else
- tx_symbols(Nc+1) = prev_tx_symbols(c+1);
+ tx_symbols(Nc+1) = prev_tx_symbols(Nc+1);
end
if pilot_bit
pilot_bit = 0;
% This really helped PAPR. We don't need to adjust rx
% phase a DPSK takes care of that
+%global phase_tx = ones(Nc+1,1);
global phase_tx = exp(j*2*pi*(0:Nc)/(Nc+1));
global phase_rx = ones(Nc+1,1);
global pilot_baseband = zeros(1, Npilotbaseband); % pilot baseband samples
global pilot_lpf = zeros(1, Npilotlpf); % LPC pilot samples
global phase_rx_pilot = [1 1];
-global freq_rx_pilot = [ exp(-j*2*pi*(Fcentre-Rs/4)/Fs) exp(-j*2*pi*(Fcentre+Rs/4)/Fs) ];
% Timing estimator states
global test_bits = rand(1,Ntest_bits) > 0.5;
global rx_test_bits_mem = zeros(1,Ntest_bits);
+% Generate M samples of DBPSK pilot signal for Freq offset estimation
+
+function [pilot_fdm bit symbol filter_mem phase] = generate_pilot_fdm(bit, symbol, filter_mem, phase, freq)
+ global M;
+ global Nfilter;
+ global gt_alpha5_root;
+
+ % +1 -1 +1 -1 DBPSK sync carrier, once filtered becomes two spectral
+ % lines at +/- Rs/2
+
+ if bit
+ symbol = -symbol;
+ else
+ symbol = symbol;
+ end
+ if bit
+ bit = 0;
+ else
+ bit = 1;
+ end
+
+ % filter DPSK symbol to create M baseband samples
+
+ filter_mem(Nfilter) = (sqrt(2)/2)*symbol;
+ for i=1:M
+ tx_baseband(i) = M*filter_mem(M:M:Nfilter) * gt_alpha5_root(M-i+1:M:Nfilter)';
+ end
+ filter_mem(1:Nfilter-M) = filter_mem(M+1:Nfilter);
+ filter_mem(Nfilter-M+1:Nfilter) = zeros(1,M);
+
+ % upconvert
+
+ for i=1:M
+ phase = phase * freq;
+ pilot_fdm(i) = sqrt(2)*2*tx_baseband(i)*phase;
+ end
+
+endfunction
+
EbNo_dB = 7.3;
Foff_hz = -100;
modulation = 'dqpsk';
-hpa_clip = 10;
+hpa_clip = 100;
% ------------------------------------------------------------
sync_log = [];
bit_errors_log = [];
+% pilot states, used for copy of pilot at rx
+
+pilot_rx_bit = 0;
+pilot_symbol = sqrt(2);
+pilot_freq = freq(Nc+1);
+pilot_phase = 1;
+pilot_filter_mem = zeros(1, Nfilter);
+
+% fixed delay simuation
+
Ndelay = M+20;
rx_fdm_delay = zeros(Ndelay,1);
prev_tx_symbols = tx_symbols;
tx_baseband = tx_filter(tx_symbols);
tx_baseband_log = [tx_baseband_log tx_baseband];
- [tx_fdm pilot] = fdm_upconvert(tx_baseband);
+ [tx_fdm pilot_tx] = fdm_upconvert(tx_baseband);
tx_pwr = 0.9*tx_pwr + 0.1*real(tx_fdm)*real(tx_fdm)'/(M);
% -------------------
% frequency offset estimation and correction
+ [pilot pilot_rx_bit pilot_symbol pilot_filter_mem pilot_phase] = generate_pilot_fdm(pilot_rx_bit, pilot_symbol, pilot_filter_mem, pilot_phase, pilot_freq);
foff = rx_est_freq_offset(rx_fdm, pilot);
foff_log = [ foff_log foff ];
%foff = 0;