functionsplineDerivatives

Function to compute the derivatives for cubic hermite spline interpolation

Extends from Modelica.Icons.Function (Icon for functions).

Information

This function computes the derivatives at the support points xi that can be used as input for evaluating a cubic hermite spline.

If ensureMonotonicity=true, then the support points yi need to be monotone increasing (or decreasing), and the computed derivatives di are such that the cubic hermite is monotone increasing (or decreasing). The algorithm to ensure monotonicity is based on the method described in Fritsch and Carlson (1980) for ρ = ρ2.

This function is typically used with Buildings.Utilities.Math.Functions.interpolate which is used to evaluate the cubic spline. Because in many applications, the shape of the spline depends on parameters which will no longer change once the initialisation is complete, this function computes and returns the derivatives so that they can be stored by the calling model to avoid repetitive computations.

References

F.N. Fritsch and R.E. Carlson, Monotone piecewise cubic interpolation. SIAM J. Numer. Anal., 17 (1980), pp. 238-246.

Inputs

TypeNameDefaultDescription
Real[:]xSupport point, strictly increasing
Real[size(x, 1)]yFunction values at x
BooleanensureMonotonicityisMonotonic(y, strict = false)Set to true to ensure monotonicity of the cubic hermite

Outputs

TypeNameDefaultDescription
Real[size(x, 1)]dDerivative at the support points

Revisions

  • January 26, 2016 by Michael Wetter:
    Corrected documentation.
  • September 29, 2011 by Michael Wetter:
    Added special case for one data point and two data points.
  • September 27, 2011 by Michael Wetter:
    First implementation.