IF
You can use the arithmetic IF operator to conditionally
evaluate a functional expression.
IF (expression 1: expression 2, expression 3, expression
4)
The method evaluates expression 1, and then operates as follows:
If the value of expression 1
is less than zero, the arithmetic IF is evaluated using expression 2.
If the value of expression 1
is equal to zero, the arithmetic IF is evaluated using expression 3.
If the value of expression 1
is greater than zero, the arithmetic IF is evaluated using expression
4.
Format
IF (A: X, Y, Z)
Arguments
A |
Any valid function expression. The software evaluates the
expression to determine which branch of the arithmetic IF <X, Y, Z>
is selected. |
X |
Any valid function expression. If the value of the test expression
is less than zero, the software evaluates the X expression and the IF
function takes on the value of X. Otherwise, the X expression is not evaluated. |
Y |
Any valid function expression. If the value of the test expression
is equal to zero, the software evaluates the Y expression and the IF function
takes on the value of Y. Otherwise, the Y expression is not evaluated. |
Z |
Any valid function expression. If the value of the test expression
is greater than zero, the software evaluates the Z expression and the
IF function takes on the value of Z. Otherwise, the Z expression is not
evaluated. |
Cautions
When using an arithmetic IF function to define motion, make
sure that the resulting motion or force is continuous. If the motion or
force is discontinuous, the motion simulation may fail to find a solution.
It is best if all functions you use to define motion or forces have continuous
first and second derivatives. It is best if you do not use the if
function to define motion.