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: Does 32 bitter code pack less efficiently than 16 bitters?
    ... preference to a 32b architecture. ... having less "spare resources" than the desktop world). ... modify the application to fit the implementation ... moving upwards; removing/reducing if moving downwards. ...
    (comp.arch.embedded)
  • 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: OT: CBO takes a look at House Republican spending plan...
    ... climate change, peak oil, overpopulation, nuclear proliferation. ... you need to find another crisis. ... Saying that you could fit the world's population in Texas ignores the ... Americans, and use much less resources, so if they want a more ...
    (rec.gambling.poker)
  • 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)