[Numpy-discussion] confused about univaritespline

Neal Becker ndbecker2@gmail....
Tue Nov 20 13:11:38 CST 2012


I don't understand why the plot of the spline continues on a negative slope at 
the end, but the plot of the integral of it flattens.

-----------------------------------------------------

import numpy as np
import matplotlib.pyplot as plt

ibo = np.array ((12, 14, 16, 18, 20, 22, 24, 26, 28, 29, 29.8, 30.2))
gain_deriv = np.array ((0, 0,  0,  0,   0, 0,  .2, .4, .5, .5, 0,    -2))

import scipy.interpolate
s = scipy.interpolate.UnivariateSpline(ibo, gain_deriv, s=0.1)

xs = linspace(12, 31, 100)
gain = np.vectorize (lambda x: s.integral (12, x)) (xs)

plot (xs, s(xs))
plot (xs, gain)



More information about the NumPy-Discussion mailing list