| Contents | Index |
Discrete
The Zero-Order Hold block holds its input for the sample period you specify. The block accepts one input and generates one output. Each signal can be scalar or vector. If the input is a vector, the block holds all elements of the vector for the same sample period.
You specify the time between samples with the Sample time parameter. A setting of -1 means the block inherits the Sample time.
Tip Do not use the Zero-Order Hold block to create a fast-to-slow transition between blocks operating at different sample rates. Instead, use the Rate Transition block. |
The Unit Delay, Memory, and Zero-Order Hold blocks provide similar functionality but have different capabilities. Also, the purpose of each block is different. The sections that follow highlight some of these differences.
| Block | Purpose of the Block | Reference Demos |
|---|---|---|
Unit Delay | Implement a delay using a discrete sample time that you specify. Ideally, the block accepts and outputs signals with a discrete sample time. |
|
Memory | Implement a delay by one integration time step. Ideally, the block accepts and outputs signals where the sample time is continuous or fixed in minor time step. For more information, see Types of Sample Time in the Simulink documentation. |
|
Zero-Order Hold | Convert an input signal with a continuous sample time to an output signal with a discrete sample time. |
| Capability | Block | ||
|---|---|---|---|
| Unit Delay | Memory | Zero-Order Hold | |
| Specification of initial condition | Yes | Yes | No, because the block output at time t = 0 must match the input value. |
| Specification of sample time | Yes | No, because the block can only inherit sample time (from the driving block or the solver used for the entire model). | Yes |
| Support for frame-based signals | Yes | No | Yes |
| Support for state logging | Yes | No | No |
When you specify a discrete sample time in the dialog box for a Unit Delay or Zero-Order Hold block, the block output can differ depending on the solver specification for the model.
Suppose that you have a model with Unit Delay and Zero-Order Hold blocks, which both use a discrete sample time of 1:

The Repeating Sequence Stair block uses a continuous sample time of 0 to provide input signals to the Unit Delay and Zero-Order Hold blocks.
If the model uses a fixed-step solver with a step size of 1, the scope shows the following simulation results:

If the model uses a variable-step solver, the scope shows the following simulation results:

The Zero-Order Hold block takes the input value of the Repeating Sequence Stair block at t = 0, 1, 2, ... , 9 and holds each input value for a sample period (1 second). The Unit Delay block applies the same 1-second hold to each input value of the Repeating Sequence Stair block, but also delays each value by a sample period. The Initial conditions parameter specifies the output for the Unit Delay block during the first sample period. For more information about sample time, see Working with Sample Times.
Solver specification for a model also affects the behavior of the Memory block. For details, see Examples of Memory Block Usage.
The Zero-Order Hold block accepts real or complex signals of any data type that Simulink supports, including fixed-point and enumerated data types.
For more information, see Data Types Supported by Simulink in the Simulink documentation.

Specify the time interval between samples. To inherit the sample time, set this parameter to -1. See How to Specify the Sample Time in the online documentation for more information.
Do not specify a continuous sample time, either 0 or [0,0]. This block supports only discrete sample times. When this parameter is -1, the inherited sample time must be discrete and not continuous.
The Zero-Order Hold block is a bus-capable block. The input can be a virtual or nonvirtual bus signal. No block-specific restrictions exist. All signals in a nonvirtual bus input to a Zero-Order Hold 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 in the Simulink User's Guide for more information.
You can use an array of buses as an input signal to a Zero-Order Hold block. For details about defining and using an array of buses, see Combining Buses into an Array of Buses.
The following models show how to use the Zero-Order Hold block:
Bus-capable | Yes |
Direct Feedthrough | Yes |
Sample Time | Specified in the Sample time parameter |
Scalar Expansion | No |
Dimensionalized | Yes |
Zero-Crossing Detection | No |

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