splrep(x, y, t)


x and y are vectors of Integral/Temporal/Floating/Decimal type that define the data points for the cubic spline curve y = f(x). Note that x and y must have the same length, and the input values of y must be in ascending order.

t (optional) is a vector indicating the knots needed. Splines can have different polynomials on either side of the knots. The values in t must satisfy the Schoenberg-Whitney conditions, meaning there must exist a subset of data points x[j] for all j=0, 1,...,n-5 such that t[j] < x[j] < t[j+4].


splrep, short for Spline Representation, is used to find the B-spline representation of a one-dimensional curve. With a given set of data points (x[i], y[i]), it determines the degree-3 smooth spline approximation over the interval x[0] <= x <= x[size(x)-1]. If NULL is included in the input values of x, y, or t, it will be filled with 0.

Return value: A tuple of length 3 containing the vector of knots, the B-spline coefficients, and the degree of the spline.


x = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
y = [0, 3, 5, 6, 5, 3, 1, 2, 4, 5]
tck= splrep(x, y, t=t)
// output

Related function: splev