ParametricSpline (FPScript)

21.09.2021

Interpolates a data set through a parametric spline curve and samples this at definable points.

Syntax

ParametricSpline(DataSet, N, SamplingMode, [ VX1 = 0 ], [ VXn = 0 ], [ VY1 = 0 ] [ , VYn = 0 ])

 

The syntax of the ParametricSpline function consists of the following parts:

Part

Description

DataSet

The data set with a constant sampling interval, which is interpolated. If you specify a data series, then the X component will be generated automatically.

Permitted data structures are data series, data matrix, signal, signal series und signal series with two-dimensional X-component. All numeric data types are permitted.

For complex data types the absolute value is formed.

If the argument is a list, then the function is executed for each element of the list and the result is also a list.

N

Specifies the total number of points or per X interval.

Permitted data structures are scalar value. All integral data types are permitted.

The value must be greater or equal to 0.

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

SamplingMode

Specifies how the calculated spline curve is to be sampled and which boundary conditions are used.

The argument SamplingMode can have the following values:

Constant

Meaning

SPLINE_EQUIDISTANT

N values equidistantly sampled.

SPLINE_INTERVAL

N values per original X interval. The number of values of the result is (NumberOfRows(DataSet) - 1) * N + 1.

...plus a constant, which determines the boundary conditions.

Constant

Meaning

+ SPLINE_NOTAKNOT

Not-A-Knot boundary condition (VX1, VY1, VXn and VYn are ignored).

+ SPLINE_1DERIVATIVE

VX1, VY1, VXn and VYn are interpreted as the first derivative of x(T) or y(T) in the first or last knot.

+ SPLINE_2DERIVATIVE

VX1, VY1, VXn and VYn are interpreted as the second derivative of x(T) or y(T) in the first or last knot.

+ SPLINE_3DERIVATIVE

VX1, VY1, VXn and VYn are interpreted as the third derivative of x(T) or y(T) in the first or last knot.

+ SPLINE_YXDERIVATIVE

VX1 or VXn is interpreted as the derivative of y(x) in the first or last knot. VY1 and VYn are ignored in this case.

+ SPLINE_PERIODIC

Periodic spline interpolation; the first and last point in the data set must be identical in this case. If this is not the case, the last point is ignored and the first is used in this location instead. The values VX1, VXn, VY1 and VYn are ignored.

+ SPLINE_PERIODICAPPEND

Periodic spline interpolation. If the first and last points in the data set are not identical, then the first point is appended to the end of DataSet in this case. The values VX1, VXn, VY1 and VYn are ignored.

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

VX1

Determines the X boundary condition at the start of the spline curve.

Permitted data structures are scalar value. All real data types are permitted.

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

If this argument is omitted, it will be set to the default value 0.

VXn

Determines the X boundary condition at the end of the spline curve.

Permitted data structures are scalar value. All real data types are permitted.

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

If this argument is omitted, it will be set to the default value 0.

VY1

Determines the Y boundary condition at the start of the spline curve.

Permitted data structures are scalar value. All real data types are permitted.

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

If this argument is omitted, it will be set to the default value 0.

VYn

Determines the Y boundary condition at the end of the spline curve.

Permitted data structures are scalar value. All real data types are permitted.

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

If this argument is omitted, it will be set to the default value 0.

Remarks

The result always has the data type 64-bit floating point.

The result has the same unit as the argument DataSet.

The parametric spline interpolation can interpolate signals where the X values are neither increasing nor equidistant. To calculate the spline function, parameter values T are generated first and then two spline interpolations are performed for x(T) and y(T). Each spline curve consists of cubic polynomials, which are appended to one another in the knots of the function y(T) or x(T) to provide the smoothest course possible. For the SPLINE_PERIODIC and SPLINE_PERIODICAPPEND boundary conditions, the data set to be interpolated must contain at least four values, and for all other boundary conditions, it must contain at least three values. Before the spline interpolation, void values in the X and Y component are eliminated by linear interpolation.

You obtain a natural spline curve with VX1, VY1, VXn and VYn as second derivatives equal to zero.

The following illustration shows parametric spline curves with different boundary conditions: The values VX1, VY1, VXn and VYn are each equal to zero:

The periodic parametric spline interpolation generates closed curves. The data set should have the same point at the beginning and at the end in this case. If this is not the case, FlexPro forces periodicity by either replacing the last point with the first or appending the first point to the end of the data set.

The following illustration shows a family of periodic parametric spline curves:

Available in

FlexPro Basic, Professional, Developer Suite

Examples

ParametricSpline({0, 1, 0}, 100, SPLINE_EQUIDISTANT)
 

 

ParametricSpline({0, 1, 0}, 100, SPLINE_EQUIDISTANT + SPLINE_1DERIVATIVE, 0, 0, -5, 5)
 

 

ParametricSpline({0, 1, 0}, 100, SPLINE_EQUIDISTANT + SPLINE_PERIODICAPPEND)
 

Since the first and last point are not identical, the first point is appended on the end of the data series for the periodic spline interpolation. Thus there are four values that are interpolated.

The following illustration shows the parametric spline curves for the three examples:

See Also

BicubicSpline Function

CompensatingSpline Function

CompensatingSpline2D Function

PeriodicSpline Function

Spline Function

Spline2D Function

Spline Interpolation Analysis Object

Surface Interpolation Analysis Object

References

[1] "Carl de Boor": "A Practical Guide to Splines, Revised Edition". "Springer-Verlag, New York",2001.ISBN 0-387-95366-3.

Share article or send as email:

You might be interested in these articles