[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] Question on threshold mathematics in correlate_an

From: Andy Walls
Subject: Re: [Discuss-gnuradio] Question on threshold mathematics in correlate_and_sync block
Date: Fri, 02 Jan 2015 08:57:22 -0500

On Wed, 2014-12-31 at 15:48 -0500, Andy Walls wrote:
> On Wed, 2014-12-31 at 14:00 -0500, Andy Walls wrote:
> > Hi.
> > 
> > Can someone give me a brief clue about the threshold testing in the
> > correlate_and_sync block?

I found my answer in this post:


"The correlation peak is tested by first observing that the width of the
correlation peak will be sps number of samples wide. So we look at
sample i and sample (i-sps). If the difference between these two symbols
is greater than the threashold we calculated in the constructor, we
declare a correlation."

That probably works for most preambles.
Unfortunately it becomes a problem with the data sequence
"101010101010..." and a rectangular pulse filter, as the absolute value
(magnitude) peaks of the correlation increase somewhat linearly as the
sequences align, and there will be a peak at every sps samples.  Thus
the threshold test won't trigger as expected.

The correlation absolute value peak happens every sps samples because,
using NRZ bit mapping (0 => -1, 1 => 1), the positive correlation is
about as strong as the neighboring negative correlation that is sps
samples away.

I'm not sure if I should file a bug report for this corner case or not.

I'm writing my own correlator block based on the correlate_and_sync
block; except that it works on real, not complex, input samples.   For
myself, I just use the unmodified output of the real valued correlation
filter and just set the threshold test to be relative to 0.

> > 
> > Then in the work function (corr is a totally different array variable
> > here):
> > 
> >       // Calculate the correlation with the known symbol
> >       d_filter->filter(noutput_items, in, corr);
> > 
> >       // Find the magnitude squared of the correlation
> >       std::vector<float> corr_mag(noutput_items);
> >       volk_32fc_magnitude_squared_32f(&corr_mag[0], corr, noutput_items);
> > 
> >       int i = d_sps;
> >       while(i < noutput_items) {
> >         if((corr_mag[i] - corr_mag[i-d_sps]) > d_thresh) {
> > 
> > This "if" test confuses me slightly.  We check to see if the value of
> > the output of the matched filtering has crossed the threshold relative
> > to one symbol previous?  Why not just check relative to 0?
> An additional note: The "if" test doesn't work too well, if the preamble
> sequence is "101010101010...", since then the correlation will have
> peaks at the symbol spacing, d_sps.  Maybe 
>       if((corr_mag[i] - corr_mag[i-d_sps/2]) > d_thresh) {
> would be better, since the correlation should sag at the half symbol?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]