Common Settings for the Function Nodes
Units
By default, functions expect dimensionless inputs and provide dimensionless outputs. When such a function is called with arguments having well-defined units (except when explicitly dimensionless), it is called with the numerical value of the argument expressed in the current unit system for the context where the function is used. The return value from the unit handling perspective behaves like a number, adapting its unit to the context where it is used. An analytic function should be seen as a numerical “black box” evaluating only numerical expressions. The inputs to the function will be converted using the unit specified, so, for example, a value of 3 meters becomes 3000 if the argument’s unit is mm. The result from the evaluation uses the selected base unit. The analytic functions do not keep a unit consistency, so that you can defined a function such as 1.23·x3 + 0.045·x2 + 0.345; the formula itself only evaluates a numerical expression.
In the Units section in the Settings window for the Analytic, Interpolation, and Piecewise function nodes, you can define units for the function’s inputs and output. In the Arguments field, type a single unit for all inputs, or specify space-separated or comma-separated units for each input (type m, s, for example, for two input arguments with the units meter and second, respectively). In the Function field, type the unit for the function’s output.
Derivatives
For External functions and MATLAB functions, enter expressions for the partial derivatives of each function with respect to their input arguments. The derivative information is needed by the automatic Jacobian computation. In the Derivatives table, each row contains a partial derivative of a function with respect to one of its arguments:
The entries in the Function name column must occur in the Functions table, and the entries in the Argument column must occur among the arguments listed for that function in the Function table.
The Partial derivative column contains expressions for the partial derivatives. Partial derivatives that are not specified in the table default to 0.
Plot Parameters
Use this table to set the range for arguments in preview plots. For each argument, enter a Lower limit, and an Upper limit in the Plot Parameters table. In Analytic function plot settings, the argument column is updated automatically and must always match the specified argument list. For External and MATLAB functions, the argument column is absent. Instead, the limits specified in the table are applied to in order from top to bottom to the arguments of the first function with a matching number of arguments. It is also this first matching function that is plotted when you click the Plot button () or the Create Plot button ().
Smoothing
Smoothing makes a function more well-behaved and suitable for modeling. It replaces jumps with smooth transitions that eliminate discontinuities and can represent the inertia present in real applications. Use smoothing to improve the behavior of the model by avoiding discontinuities that are difficult to handle numerically. The smoothed functions have continuous first and, optionally, second derivatives.
For the Step, Triangle, and Rectangle functions, enter a value in the Size of transition zone field to control the amount of smoothing. Also, set the Number of continuous derivatives to 1 or 2. The default is to make derivatives continuous up to second order. For the Ramp function, additionally specify a value, if desired, for the Size of transition zone at start and, if desired and a cutoff is active, a value for the Size of transition zone at cutoff. For the Step function, the step is the same as for the flc1hs and flc2hs smoothed step functions, depending on the settings in the Number of continuous derivatives list (see Additional Smoothed Functions). The parameter d in flc1hs(x,d), for example, is set to half of the value in the Size of transition zone field,
Note that smoothing affects for which values of the arguments the function is different from zero. In particular, when applying smoothing to a Ramp or Step function, it starts to rise before the position specified in the Location field. This may interfere with initialization assuming that the function is zero at this point.
The Waveform function also supports smoothing for some of the waveform types.