import numpy as np import scipy.interpolate as itp import matplotlib.pyplot as plt x = np.linspace(0., 5., 15) y = np.sinc(x) f3 = itp.interp1d(x, y, kind='cubic') xdense = np.linspace(0.,5., 100) yapprox = f3(xdense) yexact = np.sinc(xdense) plt.plot(x, y, 'o', xdense, yexact, '-', xdense, yapprox, '--') plt.legend(['data', 'exact', 'interpolate'], loc='best') plt.show()