Find the B-spline representation of 1-D curve.
Given the set of data points (x[i], y[i]) determine a smooth spline approximation of degree k on the interval xb <= x <= xe. The coefficients, c, and the knot points, t, are returned. Uses the FORTRAN routine curfit from FITPACK.
Parameters : | x, y : array_like
w : array_like
xb, xe : float
k : int
task : {1, 0, -1}
s : float
t : int
full_output : bool
per : bool
quiet : bool
|
---|---|
Returns : | tck : tuple
fp : array, optional
ier : int, optional
msg : str, optional
|
See also
UnivariateSpline, BivariateSpline, splprep, splev, sproot, spalde, splint, bisplrep, bisplev
Notes
See splev for evaluation of the spline and its derivatives.
References
Based on algorithms described in [1], [2], [3], and [4]:
[R33] | P. Dierckx, “An algorithm for smoothing, differentiation and integration of experimental data using spline functions”, J.Comp.Appl.Maths 1 (1975) 165-184. |
[R34] | P. Dierckx, “A fast algorithm for smoothing data on a rectangular grid while using spline functions”, SIAM J.Numer.Anal. 19 (1982) 1286-1304. |
[R35] | P. Dierckx, “An improved algorithm for curve fitting with spline functions”, report tw54, Dept. Computer Science,K.U. Leuven, 1981. |
[R36] | P. Dierckx, “Curve and surface fitting with splines”, Monographs on Numerical Analysis, Oxford University Press, 1993. |
Examples
>>> x = linspace(0, 10, 10)
>>> y = sin(x)
>>> tck = splrep(x, y)
>>> x2 = linspace(0, 10, 200)
>>> y2 = splev(x2, tck)
>>> plot(x, y, 'o', x2, y2)