[SciPy-user] question to spline interpolation

Christian Meesters meesters at uni-mainz.de
Thu Nov 23 04:21:24 CST 2006


Perhaps a dump question, but I can't find a solution:
I have a smooth, continous 1D curve, represented in an numpy array, wich I 
want to interpolate. The data in y start from zero and should an on zero.

My script (pseudocode):

from scipy import interpolate

x_new = arange(0, x_max, x_max/110) 
#x being the data points of the abscissa
#x_max is the maximum value in x

#curve interpolation with cubic spline
tck = interpolate.splrep(x, y, s=0) #no additional smoothing wanted

So far so good, but when I calculate the according to x_new with
y_inter = interpolate.splev(x_new, tck, der=0)

y_inter starts from zero but doen't end on zero, it always is a little more or 
less. The spline's order is k=3.

Any hint how I can force the interpolated curve back to zero at x_max?
(Hope my problem description was clear ...)


More information about the SciPy-user mailing list