Tjaz Brelih - 1 year ago 62

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`

Recommended for you: Get network issues from **WhatsUp Gold**. **Not end users.**

Answer Source

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.

Recommended from our users: **Dynamic Network Monitoring from WhatsUp Gold from IPSwitch**. ** Free Download**