""" SciPy Beispiel 1D Interpolation """ import numpy as np from scipy.interpolate import interp1d # xy Punktwerte z.B Messwerte x = np.linspace(0, 10, num=11, endpoint=True) y = np.array( [ 1.,0.99,0.90,0.54,-0.21,-0.93,-0.65,0.67,0.68,-0.91,0.12] ) print(y) # Interpolation f = interp1d(x, y) f2 = interp1d(x, y, kind='cubic') # Ausgabe xnew = np.linspace(0, 10, num=41, endpoint=True) import matplotlib.pyplot as plt plt.plot(x, y, 'o', xnew, f(xnew), '-', xnew, f2(xnew), '--') plt.legend(['Messdaten', 'Linear', 'Kubisch'], loc='best') plt.show()