Unit Delay
DiscreteDelays the input signal by exactly one sample period (), representing the fundamental unit delay operator () in discrete-time signal processing and digital control theory. Serves as the primary unit memory element for constructing Finite Impulse Response (FIR) and Infinite Impulse Response (IIR) digital filters, implementing recurrence relations, resolving algebraic loops in feedback paths, and maintaining state in discrete state machines.
Mathematical Model
In the discrete time domain, the unit delay acts as a single-sample memory buffer:
In the -domain, the transfer function corresponds to the backward shift operator:
When the optional bottom reset port is driven, the internal register resets synchronously to the initial condition whenever :
Inputs & Outputs
| Direction | ID | Label | Type | Status |
|---|---|---|---|---|
| → In | in |
Input | number | Required |
| → In | reset |
Reset | number | Required |
| ← Out | out |
Output | number | Output |
Parameters
| Parameters | Label | Type | Default | Description |
|---|---|---|---|---|
initialCondition |
Initial Condition | number | 0 |
Usage Examples
Example 1: First-Order Discrete Low-Pass Filter (EMA)
An Exponential Moving Average filter computes with smoothing coefficient . Feeding the output of a Sum block back into a Gain block () through a UnitDelay supplies the prior state , placing a discrete pole at and attenuating high-frequency measurement noise.
Example 2: Algebraic Loop Breaking in Closed Feedback
In closed-loop topologies where both controller and plant have direct feedthrough (), simulators detect an implicit circular dependency at time . Inserting a UnitDelay in the feedback sensor path breaks the circular algebraic dependency, allowing the simulation engine to compute the output explicitly using the previous sample's state.
Remarks & Best Practices
- Sample Time Coupling: Unlike the continuous
Delayblock which operates over physical seconds,UnitDelayshifts signals by exactly one timestep (), making its physical delay proportional to the solver's discrete step size. - Algebraic Loop Resolution: Placing a
UnitDelayon algebraic feedback paths transforms implicit equations into explicit state updates, eliminating algebraic loop warnings and iteration overhead. - Synchronous Reset: Driving the optional
resetport with a pulse greater than zero immediately resets the stored memory state toinitialCondition. - Digital Filter Topologies: Forms the canonical building block for Direct Form I, Direct Form II, and lattice filter implementations in discrete-time control.
Related Components
- Delay: Continuous-time transport delay specified in physical seconds.
- DiscreteTransferFunction: Higher-order discrete transfer function represented as a polynomial fraction in .
- DiscreteIntegrator: Discrete accumulator implementing Forward Euler, Backward Euler, or Tustin integration.
- DiscreteDerivative: Computes discrete differences .