[SciPy-user] Example of how to use B-splines for interpolation

Travis Oliphant oliphant.travis at ieee.org
Sun Jan 29 01:44:02 CST 2006

This example needs the SVN version of scipy (or you need to get the 
cspline1d_eval function out of SVN):

I sent a smaller image hoping it would make it to the list...


from numpy import r_, sin
from scipy.signal import cspline1d, cspline1d_eval

x = r_[0:10]
dx = x[1]-x[0]
newx = r_[-3:13:0.1]  # notice outside the original domain
y = sin(x)
cj = cspline1d(y)
newy = cspline1d_eval(cj, newx, dx=dx,x0=x[0])

from pylab import plot
plot(newx, newy, x, y, 'o')

Have fun,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: figure1_small.png
Type: image/png
Size: 27554 bytes
Desc: not available
Url : http://www.scipy.net/pipermail/scipy-user/attachments/20060129/e04e89c4/figure1_small-0001.png

More information about the SciPy-user mailing list