Search code examples
pythonpython-3.xnumpyscipyspline

How to define a higher-degree spline using python?


I am using the Scipy CubicSpline interpolation based on a certain number of points as shown in the diagram below:Scipy Cubic Spline

My problem is, the second derivative of the Cubic Splive function looks a little bit edgy:

Second derivative

In order to smooth the second curve I need a higher degree of spline interpolation. Is there a Scipy build in function (similar to CubicSpline) or an easy way to do that? (A b-spline function want work)


Solution

  • make_interp_spline should be able to construct BSpline objects of higher degrees (FITPACK only goes up to k=5, which is hardcoded fairly deep down).