blockSurf2d

2-D spline approximation (X,Y)->Z

Extends from Modelica.Blocks.Interfaces.SI2SO (2 Single Input / 1 Single Output continuous control block), Icons.Surf2d.

Information

Provide smooth 2D spline surface and interpolate input data

This blocks generates a 2D-surface object by approximating spline fitting. Data to be fitted may be scattered or on a rectangular grid.
Rectangular data
In case of rectangular data points, set boolean parameter rectangular 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 rectangular 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.

Parameters

TypeNameDefaultDescription
Booleanrectangularfalse= true if input data is on rectangular grid, otherwise assume scattered data
Real[:,:]dataData to be fitted: (see documentation)
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 tx, a least square spline is generated)

Connectors

TypeNameDefaultDescription
RealInputu1 (from SI2SO)Connector of Real input signal 1
RealInputu2 (from SI2SO)Connector of Real input signal 2
RealOutputy (from SI2SO)Connector of Real output signal