| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Simulink |
| Contents | Index |
| Learn more about Simulink |
Discrete

The Unit Delay block delays its input by the specified sample period. This block is equivalent to the z-1 discrete-time operator. The block accepts one input and generates one output, which can be either both scalar or both vector. If the input is a vector, all elements of the vector are delayed by the same sample period.
You specify the block output for the first sampling period with the Initial conditions parameter. Careful selection of this parameter can minimize unwanted output behavior. The time between samples is specified with the Sample time parameter. A setting of -1 means the sample time is inherited.
Note The Unit Delay block accepts continuous signals. When it has a continuous sample time, the block is equivalent to the Simulink Memory block. |
The Unit Delay block provides a mechanism for discretizing one or more signals in time.
Note Do not use the Unit Delay block to create a slow-to-fast transition between blocks operating at different sample rates. Instead, use the Rate Transition block. |
The Unit Delay block accepts real or complex signals of any data type supported by Simulink software, including fixed-point and enumerated data types. If the data type of the input signal is user-defined, the initial condition must be zero.
For a discussion on the data types supported by Simulink software, see Data Types Supported by Simulink in the Simulink documentation.

During simulation, the block uses the following values:
The initial value of the signal object to which the state name is resolved
Min and Max values of the signal object
See Block State Storage and Interfacing Considerations in the Real-Time Workshop documentation for more information.
Specify the output of the simulation for the first sampling period, during which the output of the Unit Delay block is otherwise undefined.
Default: 0
The Initial conditions parameter is converted from a double to the input data type offline using round-to-nearest and saturation.
See Block-Specific Parameters for the command-line information.
Enter the discrete interval between sample time hits or specify another appropriate sample time such as continuous or inherited.
Default: -1
By default, the block inherits its sample time based upon the context of the block within the model. To set a different sample time, enter a valid sample time based upon the table in Types of Sample Time.
See also How to Specify the Sample Time in the online documentation for more information.
See Block-Specific Parameters for the command-line information.
Use this to assign a unique name to each state.
Default: ' '
If left blank, no name is assigned.
To assign a name to a single state, enter the name between quotes, for example, 'velocity' .
The state names apply only to the selected block.
To assign names to multiple states, enter a comma-delimited list surrounded by braces. For example, {'a', 'b', 'c'} . Each name must be unique.
The number of states must be evenly divided by the number of state names. There can be fewer names than states, but there cannot be more names than states.
For example, you can specify two names in a system with four states. Simulink software will assign the first name to the first two states and the second name to the last two.
To assign state names with a variable that has been defined in the MATLAB workspace, enter the variable without quotes. A variable can be a string, cell, or structure.
This parameter enables State name must resolve to Simulink signal object when you click the Apply button.
See Block-Specific Parameters for the command-line information.
Require that state name resolve to Simulink signal object.
Default: Off
Require that state name resolve to Simulink signal object.
Do not require that state name resolve to Simulink signal object.
State name enables this parameter.
This parameter enables Real-Time Workshop storage class.
See Block-Specific Parameters for the command-line information.
Select state storage class.
Default: Auto
Auto is the appropriate storage class for states that you do not need to interface to external code.
State is stored in a global variable
model_private.h declares the state as an extern variable.
model_private.h declares the state as an extern pointer.
State name enables this parameter.
Setting this parameter to ExportedGlobal, ImportedExtern, or ImportedExternPointer enables Real-Time Workshop storage type qualifier.
See Block-Specific Parameters for the command-line information.
Specify Real-Time storage type qualifier.
Default: ' '
If left blank, no qualifier is assigned.
Setting Real-Time Workshop storage class to ExportedGlobal, ImportedExtern, or ImportedExternPointer enables this parameter.
See Block-Specific Parameters for the command-line information.
The Unit Delay block is a bus-capable block. The input can be a virtual or nonvirtual bus signal subject to the following restrictions:
Initial conditions must be zero or a non-zero scalar.
If Initial conditions is zero and a State name is specified, the input cannot be a virtual bus.
If Initial conditions is a non-zero scalar, no State name can be specified.
All signals in a nonvirtual bus input to a Unit Delay block must have the same sample time, even if the elements of the associated bus object specify inherited sample times. You can use a Rate Transition block to change the sample time of an individual signal, or of all signals in a bus. See Using Composite Signals and Bus-Capable Blocks for more information.
Bus-capable | Yes, with restrictions as noted in Bus Support |
Direct Feedthrough | No |
Sample Time | Specified in the Sample time parameter |
Scalar Expansion | Yes, of input or initial conditions |
States | Yes, inherited from driving block for nonfixed-point data types |
Dimensionalized | Yes |
Multidimensionalized | Yes |
Zero-Crossing Detection | No |
Unit Delay Enabled, Unit Delay Enabled External IC, Unit Delay Enabled Resettable, Unit Delay Enabled Resettable External IC, Unit Delay External IC, Unit Delay Resettable, Unit Delay Resettable External IC, Unit Delay With Preview Enabled, Unit Delay With Preview Enabled Resettable, Unit Delay With Preview Enabled Resettable External RV, Unit Delay With Preview Resettable, Unit Delay With Preview Resettable External RV
![]() | Uniform Random Number | Unit Delay Enabled | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |