[SciPy-user] interpolate
Anne Archibald
aarchiba@physics.mcgill...
Fri Nov 14 17:26:18 CST 2008
2008/11/14 David Warde-Farley <dwf@cs.toronto.edu>:
> On 14-Nov-08, at 5:47 PM, Travis E. Oliphant wrote:
>
>> The second-case does not provide a monotonically increasing array in
>> the
>> first argument.
If you are not fitting a function of the form y=f(x) you may want to
use the parametric spline code instead.
> Mildly related question about interpolate/FITPACK: when I fit using
> the 't=knots' arg to splrep (I have a lot more data than I want there
> to be knots, so I feed it some evenly spaced internal knots with the
> 't' parameter), it seems that the last 4 coefficients I get back are
> always zero. I was wondering if there's a good reason for this or if
> I'm doing something silly. I'm using k=3 if that makes a difference.
The knots are specified in a form that allows them all to be treated
identically. This sometimes means repeating knots or having zero
coefficients.
If you have more data points than you want knots, then you are going
to be producing a spline which does not pass through all the data. The
smoothing splines include an automatic number-of-knots selector, which
you may prefer to specifying the number of knots yourself. it chooses
(approximately) the minimum number of knots needed to let the curve
pass within one sigma of the data points, so by adjusting the
smoothing parameter and the weights you can tune the number of knots.
Evaluation time is not particularly sensitive to the number of knots
(though of course memory usage is).
Anne
More information about the SciPy-user
mailing list