# [time-nuts] DGPS at home

Hal Murray hmurray at megapathdsl.net
Sat Nov 26 17:35:38 EST 2011

```> Maybe you can figure out for use how long one must average the data to get
> down to a given position accuracy.   The fact that you have a poor location
> is good.  You are generating real-world numbers.

I'll be glad to provide lots of crappy data if anybody wants to play with it.

----------

The refclock (nmea, PPS, TBolt, ...) support in ntpd has code to discard
outliers on a clump of timestamps.  I think something like that would be very

The code is pretty simple in one dimension: sort, compute average, compare
distance to left and right ends, discard one, adjust average...  After the
sort, the processing time is linear in the number of samples to be discarded.

I haven't figured out how to do something like that in 2 dimensions: there is
no left or right end.

The basic idea you want to implement is to start with a large circle centered
on the center of mass and shrink that circle until it hits a point.  That's
the point you want to discard.

Pure brute force would compute the center of mass and then scan all the data
points computing the distance...  That's an N-squared process which might
take too long with a large clump of data.  For offline research like this, it
might be OK.

There is a slightly better approach that I'll call semi-brute force.  The
idea would be to make two lists: one for NS and one for EW, sort them, then
use the longest end as a trial point.  Then you scan in from the 4 ends.  The
semi- part is that you can stop when you get to the trial / sqrt(2).  At
first glance, discarding isn't cheap since you have to scan the other
list/array.  Actually, you don't have to scan the other list.  Just mark that
slot as dead.  In either case, you can fixup the center location rather than
recomputing it.  If you notice a dead slot on the end of a list you can
delete it.

[I'm pretty sure that will get the right answer.  I'll try again if that
description isn't clear.]

--
These are my opinions, not necessarily my employer's.  I hate spam.

```