[SciPy-user] problems with splrep,splev
Sat Apr 18 08:31:23 CDT 2009
Warren Weckesser schrieb:
> About the first error...
> On Fri, Apr 17, 2009 at 4:14 AM, Christian K. <firstname.lastname@example.org
> <mailto:email@example.com>> wrote:
> I am having problems with the spline functions from
> scipy.interpolate. Reading
> the doc strings I expected the following to work:
> from scipy.interpolate import splev,splrep
> import numpy as N
> x = N.linspace(-4,10,5)
> y = x**2
> t,c,l = splrep(x,y,xb=0,xe=4)
> Traceback (most recent call last):
> line 406, in splrep
> n,c,fp,ier = dfitpack.curfit(task, x, y, w, t, wrk, iwrk, xb, xe,
> k, s)
> error: (xb<=x) failed for 1st keyword xb
> The error message is telling you what the problem is. From the docstring:
> Given the set of data points (x[i], y[i]) determine a smooth spline
> approximation of degree k on the interval xb <= x <= xe.
> You have values in your x array outside the interval [xb,xe].
Right, but then I don't get the meaning of xb and xe at all. What sense
does it make to choose a fit interval larger than the input data? IMHO
x < xb < xe < x[-1] should hold but obviously the docs tell the opposite.
More information about the SciPy-user