Annex60.Utilities.Math.Functions.regStep

# .Annex60.Utilities.Math.Functions.regStep

Approximation of a general step, such that the approximation is continuous and differentiable

## Information

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`.

#### Interface

>     function regStep
>       extends Modelica.Icons.Function;
>       input Real x "Abscissa value";
>       input Real y1 "Ordinate value for x > 0";
>       input Real y2 "Ordinate value for x < 0";
>       input Real x_small(min = 0) = 1e-5 "Approximation of step for -x_small <= x <= x_small; x_small >= 0 required";
>       output Real y "Ordinate value to approximate y = if x > 0 then y1 else y2";
>     end regStep;

## Revisions

- February 18, 2016 by Marcus Fuchs:
  Add function with `Inline = true` in annotations to package for better performance, as suggested in #300 .
- April 29, 2008 by Martin Otter:
  Designed and implemented.
- August 12, 2008 by Michael Sielemann:
  Minor modification to cover the limit case `x_small -> 0` without division by zero.

Generated at 2026-05-09T18:18:56Z by OpenModelicaOpenModelica 1.26.7 using GenerateDoc.mos