[SciPy-user] Interpolation using splines

Michael McNeil Forbes mforbes at phys.washington.edu
Tue Sep 26 11:16:16 CDT 2006


Works for me using scipy 0.5.1.dev2185 on OS X.

Michael.

In article 
<be152e7d0609260527m5f178d2end1257e2216b49b8f at mail.gmail.com>,
 "Ewald Zietsman" <ewald.zietsman at gmail.com> wrote:

...
> #! /usr/bin/python
> from scipy import interpolate
> from pylab import *
> x = arange(0.0,2.0*pi+pi/4.0,2.0*pi/8.0)
> y = sin(x)
> tck = interpolate.splrep(x,y,s=0.0)
> xnew = arange(0.0,2.0*pi+pi/4.0,pi/50.0)
> ynew = interpolate.splev(xnew,tck,der=0.0)
> 
> plot(x,y,'x')
> plot(xnew,ynew,'r-')
> show()
> 
> 
> I should get a plot showing a sin curve made of blue x's and a smooth red
> line which is the spline...



More information about the SciPy-user mailing list