Delay discrete-time input by specified number of samples or frames
Note: Certain features of this block will be removed in a future release. See Functionality being removed or replaced for blocks and System objects. |
The Delay block delays a discrete-time input by the number of samples or frames specified in the Delay units and Delay parameters. The Delay value must be an integer value greater than or equal to zero. When you enter a value of zero for the Delay parameter, any initial conditions you might have entered have no effect on the output.
The Delay block allows you to set the initial conditions of the signal that is being delayed. The initial conditions must be numeric.
When you set the Input processing parameter to Columns as channels (frame based), the block treats each column of the M-by-N input matrix as an independent channel. The block delays each channel of the input as specified by the Delay parameter.
The Delay parameter can be a scalar integer by which the block equally delays all channels or a vector whose length is equal to the number of channels.
There are four different choices for initial conditions. The initial conditions can be the same or different for each channel. They can also be constant or varying along each channel. See the Frame-Based Processing Examples section for more information.
When you set the Input processing parameter to Elements as channels (sample based), the block treats each element of the N-D input array as an independent channel. Thus, the total number of channels in the input is equal to the product of the input dimensions. The dimension of the output is the same as that of the input.
The Delay parameter can be a scalar integer by which to equally delay all channels or an N-D array of the same dimensions as the input array, containing nonnegative integers that specify the number of sample intervals to delay each channel of the input.
There are four different choices for initial conditions. The initial conditions can be the same or different for each channel. They can also be the same or different within a channel. See the Sample-Based Processing Examples section for more information.
The Delay block resets the delay whenever it detects a reset event at the optional Rst port. The reset sample time must be a positive integer multiple of the input sample time.
The reset event is specified by the Reset port parameter, and can be one of the following:
None disables the Rst port.
Rising edge triggers a reset operation when the Rst input does one of the following:
Rises from a negative value to a positive value or zero
Rises from zero to a positive value, where the rise is not a continuation of a rise from a negative value to zero (see the following figure)
Falling edge triggers a reset operation when the Rst input does one of the following:
Falls from a positive value to a negative value or zero
Falls from zero to a negative value, where the fall is not a continuation of a fall from a positive value to zero (see the following figure)
Either edge triggers a reset operation when the Rst input is Rising edge or Falling edge (as described earlier).
Non-zero sample triggers a reset operation at each sample time that the Rst input is not zero.
Note When running simulations in the Simulink^{®} MultiTasking mode, reset signals have a one-sample latency. Therefore, when the block detects a reset event, there is a one-sample delay at the reset port rate before the block applies the reset. For more information on latency and the Simulink tasking modes, see Excess Algorithmic Delay (Tasking Latency) and Scheduling in the Simulink Coder™ User's Guide. |
This block supports Simulink virtual buses.
There are four different choices for initial conditions. The initial conditions can be the same or different for each channel. They can also be constant or varying along each channel. The next sections describe the behavior of the block for each of these four cases:
Case 1 — Use the Same Initial Conditions for Each Channel and Within a Channel
Case 4 — Use Different Initial Conditions for Each Channel and Within a Channel
Enter a scalar value for the initial conditions. This value is used as the constant initial condition value for each of the channels.
For example, suppose your input is a matrix and you set the Input processing parameter to Columns as channels (frame based).
$$\left[\begin{array}{ccc}1& 1& 1\\ 2& 2& 2\\ 3& 3& 3\end{array}\right],\left[\begin{array}{ccc}4& 4& 4\\ 5& 5& 5\\ 6& 6& 6\end{array}\right],\left[\begin{array}{ccc}7& 7& 7\\ 8& 8& 8\\ 9& 9& 9\end{array}\right],\mathrm{...}$$
You want the initial conditions of your three-channel signal to be identical and zero for the first frame:
Clear the Specify different initial conditions for each channel and the Specify different initial conditions within a channel check boxes.
Set the Initial conditions parameter to a scalar value of 0.
The output of the delay block is
$$\left[\begin{array}{ccc}0& 0& 0\\ 0& 0& 0\\ 0& 0& 0\end{array}\right],\left[\begin{array}{ccc}1& 1& 1\\ 2& 2& 2\\ 3& 3& 3\end{array}\right],\left[\begin{array}{ccc}4& 4& 4\\ 5& 5& 5\\ 6& 6& 6\end{array}\right],\left[\begin{array}{ccc}7& 7& 7\\ 8& 8& 8\\ 9& 9& 9\end{array}\right],\mathrm{...}$$
0, the scalar initial condition value, is used across the channels and within the channels for the first frame. This frame is the output at sample time zero.
The initial conditions must be a vector of length N, where N ≥ 1. N is also equal to the number of channels in your signal. These initial condition values are used as the constant initial condition value for each of the channels.
For example, suppose your input is a matrix and you set the Input processing parameter to Columns as channels (frame based).
$$\left[\begin{array}{ccc}1& 1& 1\\ 2& 2& 2\\ 3& 3& 3\end{array}\right],\left[\begin{array}{ccc}4& 4& 4\\ 5& 5& 5\\ 6& 6& 6\end{array}\right],\left[\begin{array}{ccc}7& 7& 7\\ 8& 8& 8\\ 9& 9& 9\end{array}\right],\mathrm{...}$$
You want the initial conditions of your three-channel signal to be [0 10 20] for the first frame:
Select the Specify different initial conditions for each channel check box.
Clear the Specify different initial conditions within a channel check box.
Set the Initial conditions parameter to [0 10 20].
The output of the delay block is
$$\left[\begin{array}{ccc}0& 10& 20\\ 0& 10& 20\\ 0& 10& 20\end{array}\right],\left[\begin{array}{ccc}1& 1& 1\\ 2& 2& 2\\ 3& 3& 3\end{array}\right],\left[\begin{array}{ccc}4& 4& 4\\ 5& 5& 5\\ 6& 6& 6\end{array}\right],\left[\begin{array}{ccc}7& 7& 7\\ 8& 8& 8\\ 9& 9& 9\end{array}\right],\mathrm{...}$$
The initial condition vector expands to create the frame that is output at sample time zero. Different initial conditions are used for each channel, but the same initial condition value is used with a channel.
In this case, the Delay parameter can be a scalar integer by which to equally delay all channels or a vector whose length is equal to the number of channels. All the values of this vector must be equal.
Enter the initial conditions as a vector. These values are used as the initial condition value along each of the channels to be delayed. The initial condition vector must have length equal to the value of the Delay (frames) parameter multiplied by the frame length. For example, if you want to delay your signal by two frames with frame length two and an initial condition value of 3, enter your initial condition vector as [3 3 3 3].
For example, suppose your input is a matrix and you set the Input processing parameter to Columns as channels (frame based).
$$\left[\begin{array}{ccc}1& 1& 1\\ 2& 2& 2\\ 3& 3& 3\end{array}\right],\left[\begin{array}{ccc}4& 4& 4\\ 5& 5& 5\\ 6& 6& 6\end{array}\right],\left[\begin{array}{ccc}7& 7& 7\\ 8& 8& 8\\ 9& 9& 9\end{array}\right],\mathrm{...}$$
You want the initial conditions of your three-channel signal to be the same along each of the channels to be delayed:
Clear the Specify different initial conditions for each channel check box.
Select the Specify different initial conditions within a channel check box.
Set the Initial conditions parameter to [10 20 30].
The output of the delay block is
$$\left[\begin{array}{ccc}10& 10& 10\\ 20& 20& 20\\ 30& 30& 30\end{array}\right],\left[\begin{array}{ccc}1& 1& 1\\ 2& 2& 2\\ 3& 3& 3\end{array}\right],\left[\begin{array}{ccc}4& 4& 4\\ 5& 5& 5\\ 6& 6& 6\end{array}\right],\left[\begin{array}{ccc}7& 7& 7\\ 8& 8& 8\\ 9& 9& 9\end{array}\right],\mathrm{...}$$
The initial condition vector defines the initial condition values within each of the three channels. The same initial conditions are used for each channel, but different initial condition values are used with a channel.
Enter a cell array for your initial condition values. Or, when you have a scalar delay value, you can enter the initial conditions as a matrix.
For example, suppose your input is a matrix and you set the Input processing parameter to Columns as channels (frame based).
$$\left[\begin{array}{ccc}1& 1& 1\\ 2& 2& 2\\ 3& 3& 3\end{array}\right],\left[\begin{array}{ccc}4& 4& 4\\ 5& 5& 5\\ 6& 6& 6\end{array}\right],\left[\begin{array}{ccc}7& 7& 7\\ 8& 8& 8\\ 9& 9& 9\end{array}\right],\mathrm{...}$$
You want the initial conditions of your three-channel signal to be different for each channel and along each channel.
Select the Specify different initial conditions for each channel and the Specify different initial conditions within a channel check boxes.
Set the Initial conditions parameter to either [10 20 30; 40 50 60; 70 80 90] or {[10 40 70];[20 50 80];[30 60 90]}. Each cell of the cell array represents the delay along one channel.
Regardless of whether you use a matrix or cell array, the output of the delay block is
$$\left[\begin{array}{ccc}10& 20& 30\\ 40& 50& 60\\ 70& 80& 90\end{array}\right],\left[\begin{array}{ccc}1& 1& 1\\ 2& 2& 2\\ 3& 3& 3\end{array}\right],\left[\begin{array}{ccc}4& 4& 4\\ 5& 5& 5\\ 6& 6& 6\end{array}\right],\left[\begin{array}{ccc}7& 7& 7\\ 8& 8& 8\\ 9& 9& 9\end{array}\right]\mathrm{...}$$
The initial condition matrix is the output at sample time zero. The elements of the initial condition cell array define the initial condition values within each channel. The first element, a vector, represents the initial conditions within channel 1. The second element, a vector, represents the initial conditions within channel 2, and so on. Different initial conditions are used for each channel and within the channels.
There are four different choices for initial conditions. The initial conditions can be the same or different for each channel. They can also be the same or different along each channel. The next sections describe the behavior of the block for each of these four cases:
Case 1 — Use the Same Initial Conditions for Each Channel and Within a Channel
Case 4 — Use Different Initial Conditions for Each Channel and Within a Channel
Enter a scalar value for the initial conditions. This value is used as the constant initial condition value for each of the channels.
For example, suppose your input is a matrix and you set the Input processing parameter to Elements as channels (sample based).
$$\left[\begin{array}{cc}1& 1\\ 1& 1\end{array}\right],\left[\begin{array}{cc}2& 2\\ 2& 2\end{array}\right],\left[\begin{array}{cc}3& 3\\ 3& 3\end{array}\right],\mathrm{...}$$
You want the initial conditions of your four-channel signal to be identical and zero for the first two samples:
Clear the Specify different initial conditions for each channel and Specify different initial conditions within a channel check boxes.
Set the Initial conditions parameter to a scalar value of 0.
The output of the delay block is
$$\left[\begin{array}{cc}0& 0\\ 0& 0\end{array}\right],\left[\begin{array}{cc}0& 0\\ 0& 0\end{array}\right],\left[\begin{array}{cc}1& 1\\ 1& 1\end{array}\right],\left[\begin{array}{cc}2& 2\\ 2& 2\end{array}\right],\left[\begin{array}{cc}3& 3\\ 3& 3\end{array}\right],\dots $$
0, the scalar initial condition value, is used for each channel and within the channels. It is the output at sample time zero and sample time one.
The initial conditions must be an N-D array for N-D input. The initial conditions must have the same dimensions as the input data. These initial condition values are used as the constant initial condition value for each of the channels.
For example, suppose your input is a matrix and you set the Input processing parameter to Elements as channels (sample based).
$$\left[\begin{array}{cc}1& 1\\ 1& 1\end{array}\right],\left[\begin{array}{cc}2& 2\\ 2& 2\end{array}\right],\left[\begin{array}{cc}3& 3\\ 3& 3\end{array}\right],\mathrm{...}$$
You want the initial conditions of your four-channel signal to be
$$\left[\begin{array}{cc}7& 9\\ 11& 13\end{array}\right]$$
for the first two samples:
Select the Specify different initial conditions for each channel check box.
Clear the Specify different initial conditions within a channel check box.
Set the Initial conditions parameter to [7 9; 11 13].
The output of the delay block is
$$\left[\begin{array}{cc}7& 9\\ 11& 13\end{array}\right],\text{\hspace{0.17em}}\left[\begin{array}{cc}7& 9\\ 11& 13\end{array}\right],\left[\begin{array}{cc}1& 1\\ 1& 1\end{array}\right],\left[\begin{array}{cc}2& 2\\ 2& 2\end{array}\right],\left[\begin{array}{cc}3& 3\\ 3& 3\end{array}\right],\mathrm{...}$$
The initial condition matrix is the output at sample time zero and sample time one. Different initial conditions are used for each channel; the same initial condition value is used within a channel.
In this case, for N-D sample-based inputs, the initial conditions parameter must be a vector whose length is equal to the delay value, specified by the Delay parameter. The values in this vector are used as the initial condition values along each of the channels to be delayed.
For example, suppose your input is a matrix and you set the Input processing parameter to Elements as channels (sample based).
$$\left[\begin{array}{cc}1& 1\\ 1& 1\end{array}\right],\left[\begin{array}{cc}2& 2\\ 2& 2\end{array}\right],\left[\begin{array}{cc}3& 3\\ 3& 3\end{array}\right],\mathrm{...}$$
You want the initial conditions of your four channel signal to be the same along each of the channels to be delayed:
Clear the Specify different initial conditions for each channel check box.
Select the Specify different initial conditions within a channel check box.
Set the Initial conditions parameter to [10 20].
The output of the delay block is
$$\left[\begin{array}{cc}10& 10\\ 10& 10\end{array}\right],\left[\begin{array}{cc}20& 20\\ 20& 20\end{array}\right],\left[\begin{array}{cc}1& 1\\ 1& 1\end{array}\right],\left[\begin{array}{cc}2& 2\\ 2& 2\end{array}\right],\left[\begin{array}{cc}3& 3\\ 3& 3\end{array}\right],\mathrm{...}$$
The first element of the initial conditions vector is the output, for all channels, at sample time zero. The second element of the initial conditions vector is the output, for all channels, at sample time one. The same initial conditions are used for each channel, but different initial condition values are used within a channel.
Enter a cell array for your initial condition values. The cell array must be the same size as your input signal. Each cell of the cell array represents the delay values for one channel, and must be a vector of size equal to the delay value. If you have a vector or scalar input and a scalar delay value, you can enter the initial conditions as a matrix.
For example, suppose your input is a matrix and you set the Input processing parameter to Elements as channels (sample based).
$$\begin{array}{ccc}\left[\begin{array}{cc}1& 1\end{array}\right],& \left[\begin{array}{cc}2& 2\end{array}\right],& \left[\begin{array}{cc}3& 3\end{array}\right],\dots \end{array}$$
You want the initial conditions of your two channel signal to be different for each channel and along each channel:
Select the Specify different initial conditions for each channel and Specify different initial conditions within a channel check boxes.
Set the Initial conditions parameter to [10 20; 30 40].
The output of the delay block is
$$\begin{array}{cccc}\left[\begin{array}{cc}10& 20\end{array}\right],& \left[\begin{array}{cc}30& 40\end{array}\right],& \left[\begin{array}{cc}1& 1\end{array}\right],& \left[\begin{array}{cc}2& 2\end{array}\right]\end{array}\dots $$
The first row of the initial conditions vector is the output at sample time zero. The second row of the initial conditions vector is the output at sample time one. Different initial conditions are used for each channel and within the channels.
In addition, suppose your input is a matrix and you set the Input processing parameter to Elements as channels (sample based).
$$\left[\begin{array}{cc}1& 1\\ 1& 1\end{array}\right],\left[\begin{array}{cc}2& 2\\ 2& 2\end{array}\right],\left[\begin{array}{cc}3& 3\\ 3& 3\end{array}\right],\mathrm{...}$$
You want the initial conditions of your two-channel signal to be different for each channel and along each channel:
Select the Specify different initial conditions for each channel and the Specify different initial conditions within a channel check boxes.
Set the Initial conditions parameter to {[11 15] [12 16]; [13 17] [14 18]}. The dimensions of the cell array match the dimensions of the input. Also, each element of the cell array represents the initial conditions within one channel.
The output of the delay block is
$$\left[\begin{array}{cc}11& 12\\ 13& 14\end{array}\right],\left[\begin{array}{cc}15& 16\\ 17& 18\end{array}\right],\left[\begin{array}{cc}1& 1\\ 1& 1\end{array}\right],\left[\begin{array}{cc}2& 2\\ 2& 2\end{array}\right],\mathrm{...}$$
Each element of the cell array represents the initial conditions within a channel. The first element, a vector, represents the initial conditions within channel 1. The second element, a vector, represents the initial conditions within channel 2, and so on. Different initial conditions are used for each channel and within the channels.
Specify how the block should process the input. You can set this parameter to one of the following options:
Columns as channels (frame based) — When you select this option, the block treats each column of the input as a separate channel.
Elements as channels (sample based) — When you select this option, the block treats each element of the input as a separate channel.
Note: The option Inherit from input (this choice will be removed - see release notes) will be removed in a future release. See Frame-Based Processing in the DSP System Toolbox™ Release Notes for more information. |
Select whether you want to delay your input by a specified number of Samples or Frames. This parameter appears only when you set the Input processing parameter to Columns as channels (frame based).
See Sample-Based Processing and Frame-Based Processing for a description of what format to use for each configuration of the block dialog.
Select this check box when you want the initial conditions to vary across the channels. When you do not select this check box, the initial conditions are the same across the channels.
Select this check box when you want the initial conditions to vary within the channels. When you do not select this check box, the initial conditions are the same within the channels.
Enter a scalar, vector, matrix, or cell array of initial condition values, depending on your choice for the Specify different initial conditions for each channel and Specify different initial conditions within a channel check boxes. See Sample-Based Processing and Frame-Based Processing for a description of what format to use for each configuration of the block dialog.
Determines the reset event that causes the block to reset the delay. For more information, see Resetting the Delay.
This block supports HDL code generation using HDL Coder™. HDL Coder provides additional configuration options that affect HDL implementation and synthesized logic. For more information on implementations, properties, and restrictions for HDL code generation, see Delay.
Double-precision floating point
Single-precision floating point
Fixed point (signed and unsigned)
Boolean
8-, 16-, and 32-bit signed integers
8-, 16-, and 32-bit unsigned integers
dsp.Delay | Unit Delay | Variable Fractional Delay | Variable Integer Delay