import numpy as np
import matplotlib.pyplot as plt
from scipy import interpolate

x = np.arange(0, 2.25*np.pi, np.pi/4)
y = np.sin(x)
spline = interpolate.splrep(x,y,s=0)
xnew = np.arange(0,2.02*np.pi,np.pi/50)
ynew = interpolate.splev(xnew, spline)

plt.plot(x,y,'o',xnew,ynew)
plt.legend(['Interp.-Punkte','Kubischer Spline'])
plt.axis([-0.05,6.33,-1.05,1.05])
plt.title('Interpolation mit kubischen Splines')
plt.show()
