Methods
DataInterpolations.LinearInterpolation
— TypeLinearInterpolation(u, t; extrapolation_left::ExtrapolationType.T = ExtrapolationType.None,
extrapolation::ExtrapolationType.T = ExtrapolationType.None, extrapolation_right::ExtrapolationType.T = ExtrapolationType.None,
cache_parameters = false)
It is the method of interpolating between the data points using a linear polynomial. For any point, two data points one each side are chosen and connected with a line. Extrapolation extends the last linear polynomial on each side.
Arguments
u
: data points.t
: time points.
Keyword Arguments
extrapolation
: The extrapolation type applied left and right of the data. Possible options areExtrapolationType.None
(default),ExtrapolationType.Constant
,ExtrapolationType.Linear
ExtrapolationType.Extension
,ExtrapolationType.Periodic
andExtrapolationType.Reflective
.extrapolation_left
: The extrapolation type applied left of the data. Seeextrapolation
for the possible options. This keyword is ignored ifextrapolation != Extrapolation.none
.extrapolation_right
: The extrapolation type applied right of the data. Seeextrapolation
for the possible options. This keyword is ignored ifextrapolation != Extrapolation.none
.cache_parameters
: precompute parameters at initialization for faster interpolation computations. Note: if activated,u
andt
should not be modified. Defaults tofalse
.assume_linear_t
: boolean value to specify a faster index lookup behavior for evenly-distributed abscissae. Alternatively, a numerical threshold may be specified for a test based on the normalized standard deviation of the difference with respect to the straight line (seelooks_linear
). Defaults to 1e-2.
DataInterpolations.QuadraticInterpolation
— TypeQuadraticInterpolation(u, t, mode = :Forward; extrapolation_left::ExtrapolationType.T = ExtrapolationType.None,
extrapolation::ExtrapolationType.T = ExtrapolationType.None, extrapolation_right::ExtrapolationType.T = ExtrapolationType.None,
cache_parameters = false)
It is the method of interpolating between the data points using quadratic polynomials. For any point, three data points nearby are taken to fit a quadratic polynomial. Extrapolation extends the last quadratic polynomial on each side.
Arguments
u
: data points.t
: time points.mode
::Forward
or:Backward
. If:Forward
, two data points ahead of the point and one data point behind is taken for interpolation. If:Backward
, two data points behind and one ahead is taken for interpolation.
Keyword Arguments
extrapolation
: The extrapolation type applied left and right of the data. Possible options areExtrapolationType.None
(default),ExtrapolationType.Constant
,ExtrapolationType.Linear
ExtrapolationType.Extension
,ExtrapolationType.Periodic
andExtrapolationType.Reflective
.extrapolation_left
: The extrapolation type applied left of the data. Seeextrapolation
for the possible options. This keyword is ignored ifextrapolation != Extrapolation.none
.extrapolation_right
: The extrapolation type applied right of the data. Seeextrapolation
for the possible options. This keyword is ignored ifextrapolation != Extrapolation.none
.cache_parameters
: precompute parameters at initialization for faster interpolation computations. Note: if activated,u
andt
should not be modified. Defaults tofalse
.assume_linear_t
: boolean value to specify a faster index lookup behaviour for evenly-distributed abscissae. Alternatively, a numerical threshold may be specified for a test based on the normalized standard deviation of the difference with respect to the straight line (seelooks_linear
). Defaults to 1e-2.
DataInterpolations.LagrangeInterpolation
— TypeLagrangeInterpolation(u, t, n = length(t) - 1; extrapolation::ExtrapolationType.T = ExtrapolationType.None,
extrapolation_left::ExtrapolationType.T = ExtrapolationType.None, extrapolation_right::ExtrapolationType.T = ExtrapolationType.None)
It is the method of interpolation using Lagrange polynomials of (k-1)th order passing through all the data points where k is the number of data points.
Arguments
u
: data points.t
: time points.n
: order of the polynomial. Currently only (k-1)th order where k is the number of data points.
Keyword Arguments
extrapolation
: The extrapolation type applied left and right of the data. Possible options areExtrapolationType.None
(default),ExtrapolationType.Constant
,ExtrapolationType.Linear
ExtrapolationType.Extension
,ExtrapolationType.Periodic
andExtrapolationType.Reflective
.extrapolation_left
: The extrapolation type applied left of the data. Seeextrapolation
for the possible options. This keyword is ignored ifextrapolation != Extrapolation.none
.extrapolation_right
: The extrapolation type applied right of the data. Seeextrapolation
for the possible options. This keyword is ignored ifextrapolation != Extrapolation.none
.
DataInterpolations.AkimaInterpolation
— TypeAkimaInterpolation(u, t; extrapolation::ExtrapolationType.T = ExtrapolationType.None, extrapolation_left::ExtrapolationType.T = ExtrapolationType.None,
extrapolation_right::ExtrapolationType.T = ExtrapolationType.None, cache_parameters = false)
It is a spline interpolation built from cubic polynomials. It forms a continuously differentiable function. For more details, refer: https://en.wikipedia.org/wiki/Akima_spline. Extrapolation extends the last cubic polynomial on each side.
Arguments
u
: data points.t
: time points.
Keyword Arguments
extrapolation
: The extrapolation type applied left and right of the data. Possible options areExtrapolationType.None
(default),ExtrapolationType.Constant
,ExtrapolationType.Linear
ExtrapolationType.Extension
,ExtrapolationType.Periodic
andExtrapolationType.Reflective
.extrapolation_left
: The extrapolation type applied left of the data. Seeextrapolation
for the possible options. This keyword is ignored ifextrapolation != Extrapolation.none
.extrapolation_right
: The extrapolation type applied right of the data. Seeextrapolation
for the possible options. This keyword is ignored ifextrapolation != Extrapolation.none
.cache_parameters
: precompute parameters at initialization for faster interpolation computations. Note: if activated,u
andt
should not be modified. Defaults tofalse
.assume_linear_t
: boolean value to specify a faster index lookup behaviour for evenly-distributed abscissae. Alternatively, a numerical threshold may be specified for a test based on the normalized standard deviation of the difference with respect to the straight line (seelooks_linear
). Defaults to 1e-2.
DataInterpolations.ConstantInterpolation
— TypeConstantInterpolation(u, t; dir = :left, extrapolation::ExtrapolationType.T = ExtrapolationType.None, extrapolation_left::ExtrapolationType.T = ExtrapolationType.None,
extrapolation_right::ExtrapolationType.T = ExtrapolationType.None, cache_parameters = false)
It is the method of interpolating using a constant polynomial. For any point, two adjacent data points are found on either side (left and right). The value at that point depends on dir
. If it is :left
, then the value at the left point is chosen and if it is :right
, the value at the right point is chosen. Extrapolation extends the last constant polynomial at the end points on each side.
Arguments
u
: data points.t
: time points.
Keyword Arguments
dir
: indicates which value should be used for interpolation (:left
or:right
).extrapolation
: The extrapolation type applied left and right of the data. Possible options areExtrapolationType.None
(default),ExtrapolationType.Constant
,ExtrapolationType.Linear
ExtrapolationType.Extension
,ExtrapolationType.Periodic
andExtrapolationType.Reflective
.extrapolation_left
: The extrapolation type applied left of the data. Seeextrapolation
for the possible options. This keyword is ignored ifextrapolation != Extrapolation.none
.extrapolation_right
: The extrapolation type applied right of the data. Seeextrapolation
for the possible options. This keyword is ignored ifextrapolation != Extrapolation.none
.cache_parameters
: precompute parameters at initialization for faster interpolation computations. Note: if activated,u
andt
should not be modified. Defaults tofalse
.assume_linear_t
: boolean value to specify a faster index lookup behaviour for evenly-distributed abscissae. Alternatively, a numerical threshold may be specified for a test based on the normalized standard deviation of the difference with respect to the straight line (seelooks_linear
). Defaults to 1e-2.
DataInterpolations.SmoothedConstantInterpolation
— TypeSmoothedConstantInterpolation(u, t; d_max = Inf, extrapolate = false,
cache_parameters = false, assume_linear_t = 1e-2)
It is a method for interpolating constantly with forward fill, with smoothing around the value transitions to make the curve continuously differentiable while the integral never drifts far from the integral of constant interpolation. u[end]
is ignored, except when using extrapolation types Constant
or Extension
.
Arguments
u
: data points.t
: time points.
Keyword Arguments
d_max
: Around each time pointtᵢ
there is a continuously differentiable (quadratic) transition betweenuᵢ₋₁
anduᵢ
, on the interval[tᵢ - d, tᵢ + d]
. The distanced
is determined asd = min((tᵢ - tᵢ₋₁)/2, (tᵢ₊₁ - tᵢ)/2, d_max)
.extrapolation
: The extrapolation type applied left and right of the data. Possible options areExtrapolationType.None
(default),ExtrapolationType.Constant
,ExtrapolationType.Linear
ExtrapolationType.Extension
,ExtrapolationType.Periodic
(also made smooth at the boundaries) andExtrapolationType.Reflective
.extrapolation_left
: The extrapolation type applied left of the data. Seeextrapolation
for the possible options. This keyword is ignored ifextrapolation != Extrapolation.none
.extrapolation_right
: The extrapolation type applied right of the data. Seeextrapolation
for the possible options. This keyword is ignored ifextrapolation != Extrapolation.none
.cache_parameters
: precompute parameters at initialization for faster interpolation computations. Note: if activated,u
andt
should not be modified. Defaults tofalse
.assume_linear_t
: boolean value to specify a faster index lookup behavior for evenly-distributed abscissae. Alternatively, a numerical threshold may be specified for a test based on the normalized standard deviation of the difference with respect to the straight line (seelooks_linear
). Defaults to 1e-2.
DataInterpolations.QuadraticSpline
— TypeQuadraticSpline(u, t; extrapolation::ExtrapolationType.T = ExtrapolationType.None, extrapolation_left::ExtrapolationType.T = ExtrapolationType.None,
extrapolation_right::ExtrapolationType.T = ExtrapolationType.None, cache_parameters = false)
It is a spline interpolation using piecewise quadratic polynomials between each pair of data points. Its first derivative is also continuous. Extrapolation extends the last quadratic polynomial on each side.
Arguments
u
: data points.t
: time points.
Keyword Arguments
extrapolation
: The extrapolation type applied left and right of the data. Possible options areExtrapolationType.None
(default),ExtrapolationType.Constant
,ExtrapolationType.Linear
ExtrapolationType.Extension
,ExtrapolationType.Periodic
andExtrapolationType.Reflective
.extrapolation_left
: The extrapolation type applied left of the data. Seeextrapolation
for the possible options. This keyword is ignored ifextrapolation != Extrapolation.none
.extrapolation_right
: The extrapolation type applied right of the data. Seeextrapolation
for the possible options. This keyword is ignored ifextrapolation != Extrapolation.none
.cache_parameters
: precompute parameters at initialization for faster interpolation computations. Note: if activated,u
andt
should not be modified. Defaults tofalse
.assume_linear_t
: boolean value to specify a faster index lookup behaviour for evenly-distributed abscissae. Alternatively, a numerical threshold may be specified for a test based on the normalized standard deviation of the difference with respect to the straight line (seelooks_linear
). Defaults to 1e-2.
DataInterpolations.CubicSpline
— TypeCubicSpline(u, t; extrapolation::ExtrapolationType.T = ExtrapolationType.None, extrapolation_left::ExtrapolationType.T = ExtrapolationType.None,
extrapolation_right::ExtrapolationType.T = ExtrapolationType.None, cache_parameters = false)
It is a spline interpolation using piecewise cubic polynomials between each pair of data points. Its first and second derivative is also continuous. Second derivative on both ends are zero, which are also called "natural" boundary conditions. Extrapolation extends the last cubic polynomial on each side.
Arguments
u
: data points.t
: time points.
Keyword Arguments
extrapolation
: The extrapolation type applied left and right of the data. Possible options areExtrapolationType.None
(default),ExtrapolationType.Constant
,ExtrapolationType.Linear
ExtrapolationType.Extension
,ExtrapolationType.Periodic
andExtrapolationType.Reflective
.extrapolation_left
: The extrapolation type applied left of the data. Seeextrapolation
for the possible options. This keyword is ignored ifextrapolation != Extrapolation.none
.extrapolation_right
: The extrapolation type applied right of the data. Seeextrapolation
for the possible options. This keyword is ignored ifextrapolation != Extrapolation.none
.cache_parameters
: precompute parameters at initialization for faster interpolation computations. Note: if activated,u
andt
should not be modified. Defaults tofalse
.assume_linear_t
: boolean value to specify a faster index lookup behaviour for evenly-distributed abscissae. Alternatively, a numerical threshold may be specified for a test based on the normalized standard deviation of the difference with respect to the straight line (seelooks_linear
). Defaults to 1e-2.
DataInterpolations.BSplineInterpolation
— TypeBSplineInterpolation(u, t, d, pVecType, knotVecType; extrapolation::ExtrapolationType.T = ExtrapolationType.None, extrapolation_left::ExtrapolationType.T = ExtrapolationType.None,
extrapolation_right::ExtrapolationType.T = ExtrapolationType.None)
It is a curve defined by the linear combination of n
basis functions of degree d
where n
is the number of data points. For more information, refer https://pages.mtu.edu/~shene/COURSES/cs3621/NOTES/spline/B-spline/bspline-curve.html. Extrapolation is a constant polynomial of the end points on each side.
Arguments
u
: data points.t
: time points.d
: degree of the piecewise polynomial.pVecType
: symbol to parameters vector,:Uniform
for uniform spaced parameters and:ArcLen
for parameters generated by chord length method.knotVecType
: symbol to knot vector,:Uniform
for uniform knot vector,:Average
for average spaced knot vector.
Keyword Arguments
extrapolation
: The extrapolation type applied left and right of the data. Possible options areExtrapolationType.None
(default),ExtrapolationType.Constant
,ExtrapolationType.Linear
ExtrapolationType.Extension
,ExtrapolationType.Periodic
andExtrapolationType.Reflective
.extrapolation_left
: The extrapolation type applied left of the data. Seeextrapolation
for the possible options. This keyword is ignored ifextrapolation != Extrapolation.none
.extrapolation_right
: The extrapolation type applied right of the data. Seeextrapolation
for the possible options. This keyword is ignored ifextrapolation != Extrapolation.none
.assume_linear_t
: boolean value to specify a faster index lookup behavior for evenly-distributed abscissae. Alternatively, a numerical threshold may be specified for a test based on the normalized standard deviation of the difference with respect to the straight line (seelooks_linear
). Defaults to 1e-2.
DataInterpolations.BSplineApprox
— TypeBSplineApprox(u, t, d, h, pVecType, knotVecType; extrapolation::ExtrapolationType.T = ExtrapolationType.None, extrapolation_left::ExtrapolationType.T = ExtrapolationType.None,
extrapolation_right::ExtrapolationType.T = ExtrapolationType.None)
It is a regression based B-spline. The argument choices are the same as the BSplineInterpolation
, with the additional parameter h < length(t)
which is the number of control points to use, with smaller h
indicating more smoothing. For more information, refer http://www.cad.zju.edu.cn/home/zhx/GM/009/00-bsia.pdf. Extrapolation is a constant polynomial of the end points on each side.
Arguments
u
: data points.t
: time points.d
: degree of the piecewise polynomial.h
: number of control points to use.pVecType
: symbol to parameters vector,:Uniform
for uniform spaced parameters and:ArcLen
for parameters generated by chord length method.knotVecType
: symbol to knot vector,:Uniform
for uniform knot vector,:Average
for average spaced knot vector.
Keyword Arguments
extrapolation
: The extrapolation type applied left and right of the data. Possible options areExtrapolationType.None
(default),ExtrapolationType.Constant
,ExtrapolationType.Linear
ExtrapolationType.Extension
,ExtrapolationType.Periodic
andExtrapolationType.Reflective
.extrapolation_left
: The extrapolation type applied left of the data. Seeextrapolation
for the possible options. This keyword is ignored ifextrapolation != Extrapolation.none
.extrapolation_right
: The extrapolation type applied right of the data. Seeextrapolation
for the possible options. This keyword is ignored ifextrapolation != Extrapolation.none
.assume_linear_t
: boolean value to specify a faster index lookup behaviour for evenly-distributed abscissae. Alternatively, a numerical threshold may be specified for a test based on the normalized standard deviation of the difference with respect to the straight line (seelooks_linear
). Defaults to 1e-2.
DataInterpolations.CubicHermiteSpline
— TypeCubicHermiteSpline(du, u, t; extrapolation::ExtrapolationType.T = ExtrapolationType.None, extrapolation_left::ExtrapolationType.T = ExtrapolationType.None,
extrapolation_right::ExtrapolationType.T = ExtrapolationType.None, cache_parameters = false)
It is a Cubic Hermite interpolation, which is a piece-wise third degree polynomial such that the value and the first derivative are equal to given values in the data points.
Arguments
du
: the derivative at the data points.u
: data points.t
: time points.
Keyword Arguments
extrapolation
: The extrapolation type applied left and right of the data. Possible options areExtrapolationType.None
(default),ExtrapolationType.Constant
,ExtrapolationType.Linear
ExtrapolationType.Extension
,ExtrapolationType.Periodic
andExtrapolationType.Reflective
.extrapolation_left
: The extrapolation type applied left of the data. Seeextrapolation
for the possible options. This keyword is ignored ifextrapolation != Extrapolation.none
.extrapolation_right
: The extrapolation type applied right of the data. Seeextrapolation
for the possible options. This keyword is ignored ifextrapolation != Extrapolation.none
.cache_parameters
: precompute parameters at initialization for faster interpolation computations. Note: if activated,u
andt
should not be modified. Defaults tofalse
.assume_linear_t
: boolean value to specify a faster index lookup behaviour for evenly-distributed abscissae. Alternatively, a numerical threshold may be specified for a test based on the normalized standard deviation of the difference with respect to the straight line (seelooks_linear
). Defaults to 1e-2.
DataInterpolations.PCHIPInterpolation
— FunctionPCHIPInterpolation(u, t; extrapolation::ExtrapolationType.T = ExtrapolationType.None, extrapolation_left::ExtrapolationType.T = ExtrapolationType.None,
extrapolation_right::ExtrapolationType.T = ExtrapolationType.None)
It is a PCHIP Interpolation, which is a type of CubicHermiteSpline
where the derivative values du
are derived from the input data in such a way that the interpolation never overshoots the data. See here, section 3.4 for more details.
Arguments
u
: data points.t
: time points.
Keyword Arguments
extrapolation
: The extrapolation type applied left and right of the data. Possible options areExtrapolationType.None
(default),ExtrapolationType.Constant
,ExtrapolationType.Linear
ExtrapolationType.Extension
,ExtrapolationType.Periodic
andExtrapolationType.Reflective
.extrapolation_left
: The extrapolation type applied left of the data. Seeextrapolation
for the possible options. This keyword is ignored ifextrapolation != Extrapolation.none
.extrapolation_right
: The extrapolation type applied right of the data. Seeextrapolation
for the possible options. This keyword is ignored ifextrapolation != Extrapolation.none
.cache_parameters
: precompute parameters at initialization for faster interpolation computations. Note: if activated,u
andt
should not be modified. Defaults tofalse
.assume_linear_t
: boolean value to specify a faster index lookup behaviour for evenly-distributed abscissae. Alternatively, a numerical threshold may be specified for a test based on the normalized standard deviation of the difference with respect to the straight line (seelooks_linear
). Defaults to 1e-2.
DataInterpolations.QuinticHermiteSpline
— TypeQuinticHermiteSpline(ddu, du, u, t; extrapolation_left::ExtrapolationType.T = ExtrapolationType.None,
extrapolation_right::ExtrapolationType.T = ExtrapolationType.None)
It is a Quintic Hermite interpolation, which is a piece-wise fifth degree polynomial such that the value and the first and second derivative are equal to given values in the data points.
Arguments
ddu
: the second derivative at the data points.du
: the derivative at the data points.u
: data points.t
: time points.
Keyword Arguments
extrapolation
: The extrapolation type applied left and right of the data. Possible options areExtrapolationType.None
(default),ExtrapolationType.Constant
,ExtrapolationType.Linear
ExtrapolationType.Extension
,ExtrapolationType.Periodic
andExtrapolationType.Reflective
.extrapolation_left
: The extrapolation type applied left of the data. Seeextrapolation
for the possible options. This keyword is ignored ifextrapolation != Extrapolation.none
.extrapolation_right
: The extrapolation type applied right of the data. Seeextrapolation
for the possible options. This keyword is ignored ifextrapolation != Extrapolation.none
.cache_parameters
: precompute parameters at initialization for faster interpolation computations. Note: if activated,u
andt
should not be modified. Defaults tofalse
.assume_linear_t
: boolean value to specify a faster index lookup behaviour for evenly-distributed abscissae. Alternatively, a numerical threshold may be specified for a test based on the normalized standard deviation of the difference with respect to the straight line (seelooks_linear
). Defaults to 1e-2.
Utility Functions
DataInterpolations.looks_linear
— Functionlooks_linear(t; threshold = 1e-2)
Determine if the abscissae t
are regularly distributed, taking the standard deviation of the difference between the array of abscissae with respect to the straight line linking its first and last elements, normalized by the range of t
. If this standard deviation is below the given threshold
, the vector looks linear (return true). Internal function - interface may change.
DataInterpolations.output_dim
— Functionoutput_dim(x::AbstractInterpolation)
Return the number of dimensions ndims(x(t))
of interpolation x
for a scalar t
.
DataInterpolations.output_size
— Functionoutput_size(x::AbstractInterpolation)
Return the size size(x(t))
of interpolation x
for a scalar t
.