Re: C for Polynomial Fit



On Dec 28, 7:35 pm, Gary Pace <x...@xxxxxxx> wrote:
Howdy :

Does anybody know where I can find code for a C function to fit an
(N-1)th order polynomial to N (x,y) data points. Actually I need to fit
a 5th order polynomial to 11 x,y points.

I would try the least squares method first using a math package. It
should be easy to implement and test to see if it meets your needs.
If the least squares method doesn't work I would try the Levenberg-
Marquardt algorithm which can be use to fit both linear and non-linear
functions but it may be more work and it will take up more resources.
I can't imagine using either is an embedded application as they use a
lot of resources. If you know your data set is small and fixed as
you say then I would consider solving for the 6 coefficients
symbolically using a symbolic math software. That way you have just 6
big ugly equations that are as efficient as they can be for embedded
use. This way one avoid the matrix library or macros that take up a
lot of code.

Peter Nachtwey




.



Relevant Pages

  • Re: O/T: One Down
    ... unless you consider every square mile of dry ... If all the people of earth were living in an area with the population density of Hong Kong, they would fit in Mauritania. ... We are running out of neither room nor resources and that the fullness of time has proven wrong virtually every prediction of the prophets of doom. ...
    (rec.woodworking)
  • Re: O/T: One Down
    ... unless you consider every square mile of dry ... they would fit in Mauritania. ... Mauritania is about that size, ... We are running out of neither room nor resources and that the ...
    (rec.woodworking)
  • Re: Display Window
    ... And even in portrait mode there are many resources that don't fit. ... Michael Reim ... (l'indirizzo di reply di questo messaggio non è ...
    (microsoft.public.windowsce.platbuilder)
  • Re: heavy lifting
    ... David Friedman wrote: ... resources are used for what when, the effect of one part of the project on another, and the like. ... create "pieces of paper" of any size, and then add text to them (quickly, mind you - I hate it when software is slower than the speed at which I think), and then place and re-place those pieces of paper in relation to each other as I see fit. ...
    (rec.arts.sf.composition)