Absolute Value

Shipping
absolute

Element-wise |x| on a signal (stateless)

Signature

Inputs

  • signalSignalrequired

Outputs

  • resultSignal

Description

Absolute Value applies the element-wise absolute value to every sample of an incoming signal. Internally it maps f64::abs across the buffer, so a signal of samples produces a signal of exactly samples, with timestamps preserved and length unchanged.

The operation is a pure, memoryless passthrough terminal in shape: it has a single required signal input and a single result output, and takes no parameters. It is stateless — the output at any sample depends only on that sample, so it introduces no delay, no warm-up, and behaves identically in streaming and batch execution.

The physical unit is preserved verbatim: does not change dimensionality, so a signal in V stays in V and one in m/s stays in m/s. Uncertainty () propagates through the standard first-order rule for : since and away from zero, the standard deviation is carried through unchanged, .

Mathematics

Examples

Full-wave rectification

Feed a bipolar waveform and read back its magnitude envelope precursor. A sine x[n] = sin(2\pi f t) in volts becomes |x[n]|, i.e. a rectified signal that is always and retains the V unit. Follow with smoothing to recover a mean-magnitude estimate:

signal_generator(sine, V) -> absolute -> smoothing -> sink

Error magnitude between two runs

To turn a signed residual into an unsigned error track, subtract a reference with math_operator then take the absolute value. Given residual e[n] in mm, |e[n]| yields the instantaneous error magnitude, ready for statistics (mean/max) — its is preserved so uncertainty bars survive the transform.

Applications

  • Full-wave rectification of AC signals in power-electronics and audio simulations before envelope extraction.
  • Computing absolute tracking or measurement error $|e[n]|$ for controller tuning and model validation.
  • Preparing a non-negative magnitude channel for logarithmic (dB) or RMS-style post-processing where sign is irrelevant.
  • Deriving instantaneous amplitude of a distance/displacement channel prior to peak_detection or windowed_max.

Neat

Because $|\operatorname{sgn}(x)| = 1$ everywhere except the origin, first-order uncertainty passes through untouched — unlike squaring or logarithms, absolute value neither inflates nor shrinks the reported $\sigma$.

It is a rare nonlinear operation that is exactly length- and timestamp-preserving with zero configuration, making it a safe drop-in anywhere a magnitude is needed without altering the time axis.

Known issues

At exactly $x = 0$ the derivative $\operatorname{sgn}(x)$ is undefined (the function has a corner). First-order propagation assumes $\operatorname{sgn}(0)$ effectively contributes unit sensitivity, so a sample sitting precisely at zero with large $\sigma$ underestimates the true folded (half-normal) uncertainty of the magnitude.

Absolute value discards sign information irreversibly; a downstream node cannot recover the original polarity, so branch before this node if the signed signal is still needed.

See also

absolute-valuerectificationmagnitudeelement-wisestatelessnonlinear