Tjaz Brelih - 6 months ago 19

Python Question

The data I have is always on a second degree polynomial (quadratic function). I want to find the peak of the interpolated function as accurately as possible.

So far I've been using

`interp1d`

`linspace`

`for`

`linspace`

I haven't found a way to do that using

`interp1d`

Now the only function I've found that returns the fitted polynomial coefficients is

`polyfit`

I've tried using

`UnivariateSpline`

Other polynomial fitting functions (

`BarycentricInterpolator`

`KroghInterpolator`

How accurate is

`UnivariateSpline`

Answer

In the end I went with `polyfit`

. Although the fitted function didn't go exactly through the data points the end result was still good. From the returned coefficients I got the desired x and y coordinates of the peak.