| DSP Blockset | ![]() |
Delay the discrete-time input by a specified number of samples or frames
Library
Description
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. Also, if 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. Select the Show additional parameters check box in order to specify the initial conditions.
This block reference contains the following topics:
Sample-Based Operation
When the input is a sample-based M-by-N matrix, where
and
,the block treats each of the M*N matrix elements as an independent channel.
If the input is a sample-based scalar, the Delay parameter can be a scalar integer by which to equally delay all channels. If the input is a sample-based vector, 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. If the input is a sample-based M-by-N matrix, where M>1 and N>1, then the Delay parameter can be a scalar integer by which to equally delay all channels or an M-by-N matrix of 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 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
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 sample-based matrix.

You want the initial conditions of your four-channel signal to be identical and zero for the first two samples:
2.
0.
Note how 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.
Case 2 -- Use Different Initial Conditions for Each Channel and the Same Initial Conditions Within a Channel
The initial conditions can be either a matrix for matrix input or a vector for vector input. These initial condition values are used as the constant initial condition value for each of the channels.
For example, suppose your input is a sample-based matrix.

You want the initial conditions of your four-channel signal to be
2.
[7 9; 11 13].
Note how 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.
Case 3 -- Use the Same Initial Conditions for Each Channel and Different Initial Conditions Within a Channel
In this case, if the input is a sample-based vector, 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, where the vector length is equal to the delay value. These values are used as the initial condition value along each of the channels to be delayed.
For example, suppose your input is a sample-based matrix.

You want the initial conditions of your four channel signal to be the same along each of the channels to be delayed:
2.
[10 20].
Note how 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 with a channel.
Case 4 -- Use Different Initial Conditions for Each Channel and Within a Channel
Enter a cell array for your initial condition values. Each cell of the cell array represents the delay values for one channel. The cell array must have the same size as your input signal. Or, if you have a nonmatrix input and a scalar delay value, you can enter the initial conditions as a matrix.
For example, suppose your input is a sample-based vector.

You want the initial conditions of your two channel signal to be different for each channel and along each channel:
2.
[10 20; 30 40]
Note that 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 sample-based matrix.

You want the initial conditions of your two-channel signal to be different for each channel and along each channel.
2.
[11 15] [12 16]; [13 17] [14 18]}. Note that 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.
Note how 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.
Frame-Based Operation
When the input is a frame-based M-by-N matrix, the block treats each of the N columns as an independent channel, and delays each channel as specified by the Delay parameter.
If the input is frame based, 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.
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
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 frame-based matrix.

You want the initial conditions of your three-channel signal to be identical and zero for the first frame:
1.
Note how 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.
Case 2 -- Use Different Initial Conditions for Each Channel and the Same Initial Conditions Within a Channel
The initial conditions must be a vector of length N, where
. 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 frame-based matrix.

You want the initial conditions of your three-channel signal to be [0 10 20] for the first frame:
1.
[0 10 20].
Note how the initial condition vector is expanded 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.
Case 3 -- Use the Same Initial Conditions for Each Channel and Different Initial Conditions Within 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 frame-based matrix.

You want the initial conditions of your three-channel signal to be the same along each of the channels to be delayed:
1.
[10 20 30].
Note how 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.
Case 4-- Use Different Initial Conditions for Each Channel and Within a Channel
Enter a cell array for your initial condition values. Or, if you have a scalar delay value, you can enter the initial conditions as a matrix.
For example, suppose your input is a frame-based matrix.

You want the initial conditions of your three-channel signal to be different for each channel and along each channel.
1.
[10 20 30; 40 50 60; 70 80 90] or {[10 40 70];[20 50 80];[30 60 90]}. Note that each cell of the cell array represents the delay along one channel.
Note how 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.
Resetting the Delay
The Delay block resets the delay whenever it detects a reset event at the optional Rst port. The reset signal rate must be a positive integer multiple of the rate of the data signal input.
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:
Falling edge triggers a reset operation when the Rst input does one of the following:
Either edge triggers a reset operation when the Rst input is Rising edge or Falling edge (as described above).
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, sample-based reset signals have a one-sample latency, and frame-based reset signals have one frame of latency. Thus, there is a one-sample or one-frame delay between the time the block detects a reset event, and when it applies the reset. For more information on latency and the Simulink tasking modes, see Excess Algorithmic Delay (Tasking Latency).
|
Dialog Box
Samples or Frames. You can choose to delay your signal by a certain number of samples or frames regardless of whether your input is sample or frame based.
Supported Data Types
Rst port, which is enabled by the Reset port parameter.
To learn how to convert your data types to the above data types in MATLAB and Simulink, see Supported Data Types and How to Convert to Them.
See Also
| Unit Delay |
Simulink |
| Variable Fractional Delay |
DSP Blockset |
| Variable Integer Delay |
DSP Blockset |
| DCT | Delay Line | ![]() |
Learn more about the latest releases of MathWorks products: |
| © 1994-2009 The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |