[time-nuts] Curve fitting
Bruce Griffiths
bruce.griffiths at xtra.co.nz
Wed Dec 23 10:15:58 UTC 2009
Mark Sims wrote:
> Hello Bruce,
>
> Yes, there are all sorts of pregnant packages and web sites that will solve the problem in a jiffy. But LAPACK, for instance, is over 45 megabytes long.
>
> What I am looking for is a targeted solution to the problem... a routine or set of routines that I can drop into Lady Heather with a minimum of muss and fuss that will spit out those two magic numbers.
>
> The idea is to collect data for a while, press a key, and Heather will characterize your oscillator. I have code in there that does this if you have the active temperature control working (stabilize temperature to get osc drift rate, slew temp to get osc tempco). I would like to be able to do it for the more general case where the unit is not under temperature control.
> ---------------------
> Try one of the Lapack derivatives such as clapack, Lapack++ etc
> However you will need the optimised BLAS as well.
>
Mark
You really need to use an SVD routine particularly when you have a lot
of data.
Amost anything else other than perhaps a Gram-Schmitt or Householder
method will eventually fail.
The last time I did this the package I used certainly wasn't 45
megabytes in size.
However it was C++ and not C.
It can be done with about 300 lines of Fortran source code and an
equivalent number of lines of C code.
The SVDCMP, SVDVAR and the SVDFIT routines from /Numerical Recipes/ or
their equivalents in the latest edition should suffice.
Unfortunately I only have a copy of the Fortran version at hand.
Amazon have some used copies of the C version for $11.
Bruce
More information about the time-nuts
mailing list