diff options
author | Paul Garver <garverp@gatech.edu> | 2015-07-21 17:41:02 -0400 |
---|---|---|
committer | Paul Garver <garverp@gatech.edu> | 2015-07-21 17:41:02 -0400 |
commit | 8d336d2346c4933a124101af36ed88fc0f0ca58d (patch) | |
tree | edf168456dbe6769d6363d03e2b791dcd2025c39 | |
parent | cc973de4273bd74d10504fba880804b22e462145 (diff) |
Replacing center of mass interpolation for the time_est tag with parabolic interpolation. It should be more accurate although still is a biased estimate of the time delay
-rw-r--r-- | gr-digital/lib/corr_est_cc_impl.cc | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/gr-digital/lib/corr_est_cc_impl.cc b/gr-digital/lib/corr_est_cc_impl.cc index 66645f6b5d..772fc780dc 100644 --- a/gr-digital/lib/corr_est_cc_impl.cc +++ b/gr-digital/lib/corr_est_cc_impl.cc @@ -262,17 +262,18 @@ namespace gr { add_item_tag(0, nitems_written(0) + i, pmt::intern("corr_start"), pmt::from_double(d_corr_mag[i]), d_src_id); - // Peak detector using a "center of mass" approach center - // holds the +/- fraction of a sample index from the found - // peak index to the estimated actual peak index. + // Use Parabolic interpolation to estimate a fractional + // sample delay. There are more accurate methods as + // the sample delay estimate using this method is biased. + // But this method is simple and fast. + // center between [-0.5,0.5] units of samples + // Paper Reference: "Discrete Time Techniques for Time Delay + // Estimation" G. Jacovitti and G. Scarano double center = 0.0; - if (i > 0 && i < (noutput_items - 1)) { - double nom = 0, den = 0; - for(int s = 0; s < 3; s++) { - nom += (s+1)*d_corr_mag[i+s-1]; - den += d_corr_mag[i+s-1]; - } - center = nom / den - 2.0; + if( i > 0 && i < (noutput_items - 1 )){ + double nom = d_corr_mag[i-1]-d_corr_mag[i+1]; + double denom = 2*(d_corr_mag[i-1]-2*d_corr_mag[i]+d_corr_mag[i+1]); + center = nom/denom; } // Calculate the phase offset of the incoming signal. |