EdgeDetect Block
Detects rising, falling, or any change in the input signal. Outputs 1 on detected edge, 0 otherwise.
Open EdgeDetect in BlockWerk →# EdgeDetect Block
Description
Detects changes in the input signal. Can detect rising edges (input increases), falling edges (input decreases), or any change.
Mathematical Model
\begin{aligned} &\text{rising:} && y[n] = \begin{cases} 1, & u[n] > u[n-1] \\ 0, & \text{otherwise} \end{cases} \\ &\text{falling:} && y[n] = \begin{cases} 1, & u[n] < u[n-1] \\ 0, & \text{otherwise} \end{cases} \\ &\text{either:} && y[n] = \begin{cases} 1, & u[n] \neq u[n-1] \\ 0, & \text{otherwise} \end{cases} \end{aligned}
First sample: y[0] = 0 for all modes.
Parameters
mode
Type: select (Default: "rising")
Detection mode to use. Options: Rising, Falling, Either.
threshold
Type: number (Default: 0.5)
Signal level separating low from high. An edge is a crossing of this level; move it outside the noise band to avoid spurious edges.
initialState
Type: number (Default: 0)
Initial State parameter description placeholder.
Remarks
- Pulse width: Output is high for exactly one simulation timestep per detected edge
- First sample: Always outputs 0 on the first sample (no prior state available)
- Noise sensitivity: EdgeDetect triggers on any change; pre-filter noisy signals before edge detection
- Rising vs falling: Use
risingfor positive-going thresholds,fallingfor negative-going - Either mode: Detects any change in either direction; useful for change-of-state triggers
Examples
- Zie de ingebouwde voorbeelden in de handleiding voor een demonstratie van dit blok.
See Also
- Comparator: Threshold-based comparison
- IntervalTest: Range-based detection