---
url: /dyad/stable/stdlib/DiscreteComponents/components/UnitDelay.md
description: >-
  Dyad UnitDelay docs.  A unit delay that outputs the input signal delayed by
  one sample (z@(-1)).
---

# `UnitDelay` {#UnitDelay}

A unit delay that outputs the input signal delayed by one sample (`z@(-1)`).

Clock-agnostic.

## Usage {#Usage}

`DiscreteComponents.UnitDelay(initial_condition=0)`

## Parameters: {#Parameters:}

|                Name |                                 Description | Units | Default value |
| -------------------:| -------------------------------------------:| -----:| -------------:|
| `initial_condition` | The initial condition of the delayed signal |     – |             0 |

## Connectors {#Connectors}

* `u` - This connector represents a real signal as an input to a component ([`RealInput`](/stdlib/Dyad/connectors/RealInput#RealInput))

* `y` - This connector represents a real signal as an output from a component ([`RealOutput`](/stdlib/Dyad/connectors/RealOutput#RealOutput))

## Behavior {#Behavior}

Behavior of this component cannot be rendered because it includes `path` variables.

## Source {#Source}

```dyad
"""
A unit delay that outputs the input signal delayed by one sample (`z@(-1)`).

Clock-agnostic.
"""
component UnitDelay@[input clk extends Discrete]
  "The input signal to delay"
  u = RealInput@[clk]() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": -50, "y1": 450, "x2": 50, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  "The delayed output signal"
  y = RealOutput@[clk]() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 960, "y1": 450, "x2": 1060, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  "The initial condition of the delayed signal"
  parameter initial_condition::Real = 0
relations
  y = u@(clk-1)
  initial u@(clk-1) = initial_condition
metadata {
  "Dyad": {
    "icons": {"default": "dyad://DiscreteComponents/UnitDelay.svg"},
    "doc": {"behavior": false}
  }
}
end
```

```dyad
"""
A unit delay that outputs the input signal delayed by one sample (`z@(-1)`).

Clock-agnostic.
"""
component UnitDelay
  "The input signal to delay"
  u = RealInput@[clk]() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": -50, "y1": 450, "x2": 50, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  "The delayed output signal"
  y = RealOutput@[clk]() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 960, "y1": 450, "x2": 1060, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  "The initial condition of the delayed signal"
  parameter initial_condition::Real = 0
relations
  y = u@(clk-1)
  initial u@(clk-1) = initial_condition
metadata {
  "Dyad": {
    "icons": {"default": "dyad://DiscreteComponents/UnitDelay.svg"},
    "doc": {"behavior": false}
  }
}
end
```

## Test Cases {#Test-Cases}

No test cases defined.

## Related {#Related}

* Examples

* Experiments

* Analyses

* Tests
  * [`TestNDelay`](UnitDelay.md)

  * [`TestUnitDelay`](UnitDelay.md)
