spline

Cubic spline interpolation function.

Syntax

spline(old_x, old_y, new_x)

Argument

old_x
The x vector of the curve to be interpolated.
old_y
The y vector of the curve to be interpolated.
new_x
A vector containing x values for which new y values are to be calculated.

Example

Templex Expression Results
{spline({0,3,5,8}, {2,5,9,7} ,1:5:1)} 2.43519, 3.29398, 5, 6.89583, 9
Curve Math Vectors Results
x = new_x

y = spline(c1.x, c1.y, new_x)

Given c1, a curve is created with interpolated y values at each point of new_x.

Comments

The spline function uses a cubic spline interpolation method to sample data. It estimates a y-value for each element in new_x such that the new points lie on or near the curve defined by old_x, old_y. old_x, old_y and new_x must have the same number of elements. old_x must be strictly increasing.

spline performs interpolation only. All values of new_x must fall between the minimum of old_x and the maximum of old_x.