[SciPy-User] Linear Interpolation

denis denis-bz-gg at t-online.de
Sat Jul 21 05:30:53 EDT 2012


On 19/07/2012 03:39, Tom Harris wrote:
> Greetings.
>
> I would like some help in linear interpolation. Not in doing the
> interpolation, but in choosing the points for the interpolation (are
> these called interpolants?).

The jargon is "knots";
     interpolator = UnivariateSpline( x, y, k=1, s=0 )  # s=0 interpolates
     print "knots:", interpolator.get_knots()

For fast simple quadratic interpolation in C
(not your question, but quadratic is much smoother than linear
and cheaper than cubic), see
http://stackoverflow.com/questions/3304513/stretching-out-an-array
It's for regularly-spaced x_i; for arbitrary spacing, first binary search.

You might try
http://stackoverflow.com/questions/tagged/interpolation%20or%20curve-fitting

cheers
   -- denis




More information about the SciPy-User mailing list