.ThermoSysPro.Functions.TableSplineInterpolation

Table spline interpolation

Information

## Copyright © EDF 2002 - 2026  
## ThermoSysPro Version 4.2  
Computes 2-dimensional spline interpolation based on function SplineInterpolation. The resulting 2-dimensional spline will be continuous and have continuous first derivatives.   
Implementation  
It uses a cardinal spline interpolation algorithm. Cardinal splines are a sub-set of cubic Hermite splines where each piece is a third-degree polynomial specified in Hermite form: i.e specified by its values and the first derivatives at the end points of the reference interval.  
The derivatives are calculated based on the non-uniform cardinal grid approach, see function SplineInterpolation for futher details.  
Inputs  

TabP: vecor containing p-table values  
TabX: Vector containing x-table values  
TabY: Vector containing y-table values  
P: The p-value that the spline should be evaluated at  
X: The x-value that the spline should be evaluated at  
t: Cardinal spline shape parameter. t = 0.5 is default and is generally a good choice. A value close to 1 will yield a stiff spline, t=0 corresponds to a Catmull-Rom spline and  t < 0 corresponds to a more “loose” spline. From testing, t=0.5  seems to be a good choice in general and is therefore chosen as a default value. A value of t = 1 corresponds to that the derivative in all data points is zero, which may result in strange curves . See Examples > TestSplineInterpolation for a demonstration.  

Output  

Y: Interpolated value evaluated at P,X  

Extrapolation  
Linear extrapolation is employed if the reference value is not contained in the reference value table.  
Example  

TabX = {1,2,3,4};  
TabP = {1,2,3,4};  
TabY =  [2,2,2,2;2,2,1,2;2,2,2,2;1,2,1,2];   

TabY respresents the value table, and TabX and TabP represent the reference tables.  
The example was called for X = linspace(0,0.1,5) and P = linspace(0.1,0.1,4)  
The black dots represent the data points, and the red lines represent the interpolation result.  

References  
http://people.cs.clemson.edu/~dhouse/courses/405/notes/splines.pdf  
    

Interface

function TableSplineInterpolation
  input Real TabP[:] "1st reference table";
  input Real TabX[:] "2nd reference table";
  input Real TabY[:, :] "Results table";
  input Real P "1st reference value";
  input Real X "2nd reference value";
  input Real t = 0.5 "Stiffness parameter";
  output Real Y "Interpolated result";
end TableSplineInterpolation;

Revisions


Generated at 2026-07-12T20:48:41Z by OpenModelicaOpenModelica 1.27.0 using GenerateDoc.mos