From: drowe67 Date: Fri, 30 Mar 2012 09:11:41 +0000 (+0000) Subject: added function to generate pilot signal at rx X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=985f91386d5515dd73a6cf5cc36dfea82f630492;p=freetel-svn-tracking.git added function to generate pilot signal at rx git-svn-id: https://svn.code.sf.net/p/freetel/code@358 01035d8c-6547-0410-b346-abe4f91aad63 --- diff --git a/codec2-dev/octave/fdmdv.m b/codec2-dev/octave/fdmdv.m index 71a098c2..fbecfcfe 100644 --- a/codec2-dev/octave/fdmdv.m +++ b/codec2-dev/octave/fdmdv.m @@ -127,9 +127,9 @@ function tx_symbols = bits_to_qpsk(prev_tx_symbols, tx_bits, modulation) % 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; @@ -539,6 +539,7 @@ freq(Nc+1) = exp(j*2*pi*Fcentre/Fs); % 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); @@ -551,7 +552,6 @@ global Npilotlpf = 4*M; % number of samples we D 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 @@ -565,3 +565,42 @@ global current_test_bit = 1; 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 + diff --git a/codec2-dev/octave/fdmdv_ut.m b/codec2-dev/octave/fdmdv_ut.m index 89c02c14..ae77ae66 100644 --- a/codec2-dev/octave/fdmdv_ut.m +++ b/codec2-dev/octave/fdmdv_ut.m @@ -17,7 +17,7 @@ frames = 100; EbNo_dB = 7.3; Foff_hz = -100; modulation = 'dqpsk'; -hpa_clip = 10; +hpa_clip = 100; % ------------------------------------------------------------ @@ -41,6 +41,16 @@ tx_fdm_log = []; 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); @@ -93,7 +103,7 @@ for i=1:frames 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); % ------------------- @@ -138,6 +148,7 @@ for i=1:frames % 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;