.BuildingSystems.Utilities.Math.Functions.smoothInterpolation

Information

For xSup1 ≤ x ≤ xSupn, where n is the size of the support points xSup, which must be strictly monotonically increasing, this function interpolates using cubic hermite spline. For x outside this interval, the function linearly extrapolates.

If n=2, linear interpolation is used an if n=1, the function value y1 is returned.

Note that if xSup and ySup only depend on parameters or constants, and therefore will not change during the simulation, it is more efficient to first call BuildingSystems.Utilities.Math.Functions.splineDerivatives to find the derivatives, and then call BuildingSystems.Utilities.Math.Functions.interpolate to perform the interpolation. This way the derivatives only need to be computed once upon initialisation, not at each step during the simulation. See the example implemented in BuildingSystems.Utilities.Math.Functions.Examples.Interpolate.

In contrast to the function Modelica.Math.Vectors.interpolate which provides linear interpolation, this function does not trigger events.

For how to use this function, see BuildingSystems.Utilities.Math.Functions.Examples.SmoothInterpolation.

Interface

function smoothInterpolation
  extends Modelica.Icons.Function;
  input Real x "Abscissa value";
  input Real xSup[:] "Support points (strictly increasing)";
  input Real ySup[size(xSup, 1)] "Function values at xSup";
  input Boolean ensureMonotonicity = isMonotonic(ySup, strict = false) "Set to true to ensure monotonicity of the cubic hermite";
  output Real yInt "Interpolated ordinate value";
end smoothInterpolation;

Revisions


Generated at 2024-11-22T19:25:38Z by OpenModelicaOpenModelica 1.24.2 using GenerateDoc.mos