multipath perf not so great
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Wed, 4 Apr 2018 23:55:33 +0000 (23:55 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Wed, 4 Apr 2018 23:55:33 +0000 (23:55 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@3446 01035d8c-6547-0410-b346-abe4f91aad63

codec2-dev/octave/fsk_basic_alt.m

index e3cc8d909f56f0d0bfe88721edf88ba27dd03c94..981e47ee62d9152d8bbc9d1a8108b1387bb0b3f8 100644 (file)
@@ -5,8 +5,21 @@
 % for multipath channels.
 
 #{
-  [ ] IL curves for half tone spacing
-      + cf to channel with multipath
+
+  So alternate tone spacings at Rs/2 worked quite well, no implementation loss
+  but odd spectrum.
+
+  But when multipath added (e.g 2ms delay on 2.5ms Rs), performance the same
+  as for non-stepped tones.  Multipath echo must be interfering with stepped
+  tone.
+
+  When 2nd step of tones are Rs spaced - then multipath perf much better,
+  as expected.
+
+  There is also the impact of freq selective fading as well as ISI, FSK
+  tone level will be pushed down and we may choose wrong tone.
+
+  Also be interesting to test FSK with FEC on HF, combined response.
 #}
 
 % make sure we get same results from random number generators on each run
@@ -18,16 +31,18 @@ randn('seed',1);
 
 Fs = 8000;     % sample rate
 f1 = 1000;
-f2 = 1800;
-f3 = 1400;
-f4 = 2200;
-Rs = 800;      % symbol rate
+f2 = 1400;
+f3 = 1200;
+f4 = 1600;
+Rs = 400;      % symbol rate
 Ts = Fs/Rs;    % length of each symbol in samples
 
 % simulation parameters -----------------------------------------------
 
 Nbits = 10000;
 EbNodB = 9;    
+multipath = 1;
+stepped = 1;
 
 % start simulation ----------------------------------------------------
 
@@ -39,24 +54,21 @@ w1 = 2*pi*f1/Fs;
 w2 = 2*pi*f2/Fs;
 w3 = 2*pi*f3/Fs;
 w4 = 2*pi*f4/Fs;
+
+% choose tones here, e.g. offset on every 2nd symbol
+
+if stepped
+  w = [w1 w2; w3 w4];
+else
+  w = [w1 w2; w1 w2];
+end
+
 tx_phase = 0;
 tx = zeros(1,Ts*Nbits);
 
 for i=1:Nbits
   for k=1:Ts
-    if mod(i,2)
-      if tx_bits(i)
-        tx_phase += w2;
-      else
-        tx_phase += w1;
-      end
-    else
-      if tx_bits(i)
-        tx_phase += w4;
-      else
-        tx_phase += w3;
-      end
-    end    
+    tx_phase += w(1+mod(i-1,2),1+tx_bits(i));
     tx((i-1)*Ts+k) = exp(j*tx_phase);
   end
 end
@@ -67,8 +79,12 @@ EbNo = 10^(EbNodB/10);
 variance = Fs/(Rs*EbNo);
 noise = sqrt(variance/2)*(randn(1,Nbits*Ts) + j*randn(1,Nbits*Ts));
 
-d = Ts/2; l = length(tx);
 rx = tx + noise;
+if multipath
+  d = 0.002*Fs;
+  tx_delayed = [zeros(1,d) tx(1:end-d)];
+  rx +=  0.5*tx_delayed;
+end
 
 figure(1); clf;
 Tx = abs(fft(tx(1:Fs)));
@@ -79,13 +95,9 @@ plot(Tx);
 rx_bits = zeros(1,Nbits);
 for i=1:Nbits
   arx_symb = rx((i-1)*Ts + (1:Ts));
-  if mod(i,2)
-    filt1 = sum(exp(-j*w1*(1:Ts)) .* arx_symb);
-    filt2 = sum(exp(-j*w2*(1:Ts)) .* arx_symb);
-  else
-    filt1 = sum(exp(-j*w3*(1:Ts)) .* arx_symb);
-    filt2 = sum(exp(-j*w4*(1:Ts)) .* arx_symb);
-  end
+  wr = 1+mod(i-1,2);
+  filt1 = sum(exp(-j*w(wr,1)*(1:Ts)) .* arx_symb);
+  filt2 = sum(exp(-j*w(wr,2)*(1:Ts)) .* arx_symb);
   rx_bits(i) = filt2 > filt1;
 end