cubic-spline

How to perform cubic spline interpolation in python?

How to perform cubic spline interpolation in python? Question: I have two lists to describe the function y(x): x = [0,1,2,3,4,5] y = [12,14,22,39,58,77] I would like to perform cubic spline interpolation so that given some value u in the domain of x, e.g. u = 1.25 I can find y(u). I found this in …

Total answers: 8

Why does InterpolatedUnivariateSpline return nan values

Why does InterpolatedUnivariateSpline return nan values Question: I have some data, y vs x, which I would like to interpolate at a finer resolution xx using a cubic spline. Here is my dataset: import numpy as np print np.version.version import scipy print scipy.version.version 1.9.2 0.15.1 x = np.array([0.5372973, 0.5382103, 0.5392305, 0.5402197, 0.5412042, 0.54221, 0.543209, 0.5442277, …

Total answers: 3

Splines with Python (using control knots and endpoints)

Splines with Python (using control knots and endpoints) Question: I’m trying to do something like the following (image extracted from wikipedia) #!/usr/bin/env python from scipy import interpolate import numpy as np import matplotlib.pyplot as plt # sampling x = np.linspace(0, 10, 10) y = np.sin(x) # spline trough all the sampled points tck = interpolate.splrep(x, …

Total answers: 5