[time-nuts] Modified Total Deviation calculation
Magnus Danielson
magnus at rubidium.dyndns.org
Tue Jan 19 10:17:06 UTC 2010
John Miles wrote:
> If you'd like to make the C source available, I'll look at building an
> incremental version...?
If you can accept the current quick-hack state of the code (yes, I am
not too proud of the cleanness, so no comments about coding style or the
general uglyness), find it attached. The main goal of this code is
correctness. Find it attached.
I'll hacking away further.
An incremental version is a trivial extention for MTOTDEV as the outer
loop steps the 3*m sample window over the data-samples. So you need to
keep a 3*m big backlog of samples for the largest m you need. For
simplicity I made the expantion into the 9*m series explicit and with a
3*m offset from the index of the original data only for clarity while
debugging the code. Some of that debugging was not in the core
algorithm, but in the missing 0.73 factor, which is the bias factor for
white FM noise. A good quality measure would adjust the bias factor
based on the dominant noise-source, but that comes as later refinement.
Anyway, hope you find the code usefull. Will hack away to make more
values calculated. Currently the Hadamard Total Deviation is not
correct, as a quick-check with SP1065 page 118 would tell you. But that
was a quick-hack anyway.
Oh, yes... among the particular uglyness issues is that the routines
know just how many samples the time or frequency sample series contains.
Ugly as hell, but for the intended purpose (known test-series) that is ok.
Cheers,
Magnus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: adev.c
Type: text/x-csrc
Size: 8614 bytes
Desc: not available
URL: <http://www.febo.com/pipermail/time-nuts/attachments/20100119/a23b1c95/attachment-0001.c>
More information about the time-nuts
mailing list