Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

regStep function

regStep function

Greetings,

I would like to have some information about the may the regStep function works.
The documentation states the following:


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.

Therefore, I understand that the f function has the following conditions to keep the fucntion continuous and differentiable:
f(x_small) = y1(x_small)
f'(x_small) = y1'(x_small)
f(-x_small) = y2(-x_small)
f'(-x_small) = y2'(-x_small)
The documentation states that f would be a second degree polynomial. However, a second degree polynomial has only three parameters (a, b and c in case of ax2 +bx + c) and therefore we would have a set of four equations woth only three unknowns that may be unsolvable (e.g. you can take y1(x) = -x+1, y2(x) = 0 and x_small = 1).
I would therefore like to understand how this function actually works and if I made a mistake in my understanding of this function.
Thanks

Edited by: xazhi - Oct-08-21 06:58:28
There are 0 guests and 0 other users also viewing this topic