.ApproxSpline.Surf2d.Type.constructor

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.

Interface

function constructor
  extends Modelica.Icons.Function;
  input Boolean rectangular = false "set true if input data is on rectangular grid, otherwise assume scattered data";
  input Real data[:, :] "data to be fitted (see doku)";
  input Real s(min = 0) = 0 "smoothing factor (s>0)";
  input Integer kx(min = 1, max = 5) = 3 "degree of X-dir spline (should be odd)";
  input Integer ky(min = 1, max = 5) = 3 "degree of Y-dir spline (should be odd)";
  input Real x_lim[2] = {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";
  input Real y_lim[2] = {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";
  input Real tx[:] = fill(0, 0) "array of X-dir knot positions (if given together with ty, a least square spline is generated)";
  input Real ty[:] = fill(0, 0) "array of Y-dir knot positions (if given together with ty, a least square spline is generated)";
  output Type surf "2-D spline surface data structure";
end constructor;

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