Absolute value of input
control block
discrete
abs
absolute value
Diagram
\[ x_j = |x_i | \]
Absolute value of input diagram
Syntax:
- function name: abs
- input variable : \(x_i\)
- output variable: \(x_j\)
Internal states : none
Discrete variable : \(z \in \{-1,1\}\)
Equations
\[ 0 = \left\{ \begin{array}{lll} x_j - x_i & if & z=1 \\ x_i - x_j & if & z=-1 \end{array} \right. \]
Discrete transitions
if z = 1 then
if xi < 0 then
z ← −1
end if
else
if xi > 0 then
z ← 1
end if end if
Initialization of discrete variables
if xi > 0 then
z ← 1
else
z ← 0 end if