splev(x, tck)


x is a vector that specifies a set of data points to obtain corresponding values on the spline.

tck can be a tuple of length 3 or a B-spline curve object that contains a vector t of knots, the B-spline coefficients, and the degree k of the spline. It can be generated with function splrep. Note that the spline degree k must satisfy 1 <= k <= 5.


splev, short for Spline Evaluation, is used to evaluate B-spline curves or their derivatives. Given the knots and coefficients of the B-spline representation, this function calculates the values of the smooth polynomials and their derivatives. If NULL is included in the input values of x or tck, it will be filled with 0.

Return value: y, a DOUBLE type vector that represents the array of spline function values evaluated at points x.


It is not recommended to use a user-defined tck. If it is not generated by function splrep, the returned y may contain random values or be filled with 0s.


x = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
y = [0, 3, 5, 6, 5, 3, 1, 2, 4, 5]
newx = [0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5]
tck= splrep(x, y, t=t)
// output

newy = splev(newx, tck)
// output

Related function: splrep