functionconstructor

create a 2D-Spline object

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

Information

Generate smooth 2D spline surface

This function generates a 2D-surface object by approximating spline fitting. Input data may be scattered or on a rectangular grid.
Rectangular data
In case of rectangular data points, set boolean parameter isRect to true and provide the data as array in the common Modelica table form:

  0 | y1 | y2 | y3 | ...
  --+----+----+----+-----
 x1 | z11| z12| z13| ...
 x2 | z21| z22| z23| ...
 x3 | z31| z32| z33| ...
 ...| ...| ...| ...| ...

Scattered data
In case of scattered data points, set parameter isRect to false and provide the data as 3- or 4-column array:

 x1 | y1 | z1 | w1 |
 x2 | y2 | z2 | w2 |
 x3 | y3 | z3 | w3 |
 ...| ...| ...| .. |

or

 x1 | y1 | z1 |
 x2 | y2 | z2 |
 x3 | y3 | z3 |
 ...| ...| ...|

The last column w[i] is the optional weight of the data points. If no weights are given, any data points are weighted equally.

Inputs

TypeNameDefaultDescription
Booleanrectangularfalseset true if input data is on rectangular grid, otherwise assume scattered data
Real[:,:]datadata to be fitted (see doku)
Reals0smoothing factor (s>0)
Integerkx3degree of X-dir spline (should be odd)
Integerky3degree of Y-dir spline (should be odd)
Real[2]x_lim{if rectangular then ApproxSpline.Utilities.vmin(data[2:size(data, 1), 1]) else ApproxSpline.Utilities.vmin(data[:, 1]), if rectangular then ApproxSpline.Utilities.vmax(data[2:size(data, 1), 1]) else ApproxSpline.Utilities.vmax(data[:, 1])}X-dir boundaries of interpolation interval
Real[2]y_lim{if rectangular then ApproxSpline.Utilities.vmin(data[1, 2:size(data, 2)]) else ApproxSpline.Utilities.vmin(data[:, 2]), if rectangular then ApproxSpline.Utilities.vmax(data[1, 2:size(data, 2)]) else ApproxSpline.Utilities.vmax(data[:, 2])}Y-dir boundaries of interpolation interval
Real[:]txfill(0, 0)array of X-dir knot positions (if given together with ty, a least square spline is generated)
Real[:]tyfill(0, 0)array of Y-dir knot positions (if given together with ty, a least square spline is generated)

Outputs

TypeNameDefaultDescription
Typesurf2-D spline surface data structure