Absolute Value
MathThe Absolute Value block computes the mathematical magnitude (absolute value) of the input signal. The output is always non-negative regardless of the sign of the input.
In control engineering and instrumentation, this block is fundamental for computing tracking error magnitudes (such as Integral of Absolute Error, IAE), rectifying alternating signals (AC to pulsating DC), formulating Lyapunov candidate functions, and bounding state variables.
Mathematical Model
The function is continuous everywhere but non-differentiable at the origin , where the subdifferential is the set .
Inputs & Outputs
| Direction | ID | Label | Type | Status |
|---|---|---|---|---|
| → In | in |
Input | number | Required |
| ← Out | out |
Output | number | Output |
Usage Examples
Example 1: Full-Wave Signal Rectification
Connecting an alternating sine wave with amplitude and frequency to the Abs block folds the negative half-cycles into positive peaks. The output exhibits a DC component of and an AC ripple fundamental frequency of , modeling an ideal diode bridge rectifier.
Example 2: Integral of Absolute Error (IAE) Performance Index
In closed-loop controller benchmarking, the error signal from a Subtraction block feeds into an Abs block, whose output is integrated by an Integrator block. The resulting metric provides a non-cancelling penalty for transient deviations, essential for automated PID tuning algorithms.
Remarks & Best Practices
- Non-negative Output: Output signal is strictly for all real input values.
- Zero-Crossing Singularity: The derivative exhibits a jump discontinuity at ; numerical variable-step solvers may refine step sizes near zero crossings to maintain accuracy.
- Computational Efficiency: Implemented as native IEEE-754 floating-point bitmasking (
f64::abs) in the WebAssembly engine with zero loop overhead. - Euclidean Norms: Combine with Product and SquareRoot blocks to compute Euclidean distances and vector magnitudes: .
Related Components
- Product: Signal multiplication and squaring
- SquareRoot: Calculation of root-mean-square (RMS) values
- Saturation: Clamps signals between upper and lower bounds