Math

Divide Block

Divides the numerator signal by the denominator signal

Open Divide in BlockWerk →

# Divide Block

Description

The Divide block performs algebraic division of two input signals: the numerator and the denominator. This block includes built-in protection against division by zero, allowing simulations to remain stable even when mathematical singularities are encountered.

The block features two distinct input ports: the upper port for the numerator (num) and the lower port for the denominator (den).

Mathematical Model

The Divide block implements:

y(t) = num(t) / den(t)

Where:

Division by Zero Protection

If the absolute value of the denominator is less than 2.22e-16 (machine epsilon), the block applies protection logic: 1. Returns the user-configurable divByZeroValue. 2. Displays a one-time visual popup warning in the UI to notify you of the event. 3. Logs a detailed message to the browser console.

The visual warning is only shown once per singular event (it resets if the denominator becomes non-zero and then zero again).

Parameters

divByZeroValue

The specific numerical value to output when a division by zero is detected.

reportWarning

When enabled (true), the block will send a warning message to the browser's developer console every time a division by zero occurs.

Examples

Signal Normalization

Normalize a signal within the range of 0 to 1:

Measurement → Divide (num)
MaxValue → Divide (den)

Resistance Calculation (Ohm's Law)

Calculate resistance from voltage and current:

Voltage → Divide (num)
Current → Divide (den)

*Tip: Set divByZeroValue to a very high number to represent the infinite resistance of an open circuit when current is 0.*

Remarks

See Also