This function is used to approximate the equation
y = if x > 0 then y1 else y2;
by a smooth characteristic, so that the expression is continuous and differentiable:
y = smooth(1, if x > x_small then y1 else if x < -x_small then y2 else f(y1, y2));
In the region -x_small < x < x_small
a 2nd order polynomial is used
for a smooth transition from y1
to y2
.
function regStep extends TRANSFORM.Icons.Function; input Real pos "Ordinate value for x > 0"; input Real neg "Ordinate value for x < 0"; input Real x "Abscissa value"; input Real deltax(min = 0) = 1e-5 "Approximation of step for -deltax <= x <= deltax; deltax >= 0 required"; output Real y "Ordinate value to approximate y = if x > 0 then y1 else y2"; end regStep;