Fitting polynomials to data

前端 未结 10 2172
生来不讨喜
生来不讨喜 2020-11-28 01:39

Is there a way, given a set of values (x,f(x)), to find the polynomial of a given degree that best fits the data?

I know polynomial interpolation, whic

10条回答
  •  广开言路
    2020-11-28 02:15

    Yes, the way this is typically done is by using least squares. There are other ways of specifying how well a polynomial fits, but the theory is simplest for least squares. The general theory is called linear regression.

    Your best bet is probably to start with Numerical Recipes.

    R is free and will do everything you want and more, but it has a big learning curve.

    If you have access to Mathematica, you can use the Fit function to do a least squares fit. I imagine Matlab and its open source counterpart Octave have a similar function.

提交回复
热议问题