DSP Blockset | ![]() ![]() |
Delay an input by an integer number of sample periods.
Library
Description
The Integer Delay block delays a discrete-time input by the number of sample intervals specified in the Delay parameter. Noninteger delay values are rounded to the nearest integer, and negative delays are clipped at 0.
Sample-Based Operation
When the input is a sample-based M-by-N matrix, the block treats each of the M*N matrix elements as an independent channel. The Delay parameter, v, can be an M-by-N matrix of positive integers that specifies the number of sample intervals to delay each channel of the input, or a scalar integer by which to equally delay all channels.
For example, if the input is M-by-1 and v is the matrix [v(1) v(2) ... v(M)]'
, the first channel is delayed by v(1)
sample intervals, the second channel is delayed by v(2)
sample intervals, and so on. Note that when a channel is delayed for sample-time units, the output sample at time
is the input sample at time
. If
is negative, then the output is the corresponding value specified by the Initial conditions parameter.
A 1-D vector of length M is treated as an M-by-1 matrix, and the output is 1-D.
The Initial conditions parameter specifies the output of the block during the initial delay in each channel. The initial delay for a particular channel is the time elapsed from the start of the simulation until the first input in that channel is propagated to the output. Both fixed and time-varying initial conditions can be specified in a variety of ways to suit the dimensions of the input.
Fixed Initial Conditions. A fixed initial condition in sample-based mode can be specified as one of the following:
Initial conditions cannot be specified by full matrices.
Time-Varying Initial Conditions. A time-varying initial condition in sample-based mode can be specified in one of the following ways:
the block outputs the sequence -1, -1, -1, 0, 1,...
at the start of the simulation.
Initial conditions cannot be specified by full matrices.
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.
For frame-based inputs, the Delay parameter can be a scalar integer by which to equally delay all channels. It can also be a 1-by-N row vector, each element of which serves as the delay for the corresponding channel of the N-channel input. Likewise, it can also be an M-by-1 column vector, each element of which serves as the delay for one of the corresponding M samples for each channel. The Delay parameter can be an M-by-N matrix of positive integers as well; in this case, each element of each channel is delayed by the corresponding element in the delay matrix. For instance, if the fifth element of the third column of the delay matrix was 3, then the fifth element of the third channel of the input matrix is always delayed by three sample-time units.
When a channel is delayed for sample-time units, the output sample at time
is the input sample at time
. If
is negative, then the output is the corresponding value specified in the Initial conditions parameter.
The Initial conditions parameter specifies the output during the initial delay. Both fixed and time-varying initial conditions can be specified. The initial delay for a particular channel is the time elapsed from the start of the simulation until the first input in that channel is propagated to the output.
Fixed Initial Conditions. The settings shown below specify fixed initial conditions. The value entered in the Initial conditions parameter is repeated at the output for each sample time of the initial delay. A fixed initial condition in frame-based mode can be one of the following:
Initial conditions cannot be specified by full matrices.
Time-Varying Initial Conditions. The following settings specify time-varying initial conditions. For time-varying initial conditions, the values specified in the Initial conditions parameter are output in sequence during the initial delay. A time-varying initial condition in frame-based mode can be specified in the following ways:
[1:100; 1:100]'
with a frame size of 4 and the parameter settings below,
the block outputs the following sequence of frames at the start of the simulation.
[1:100; 1:100]'
with a frame size of 4 and the parameter settings below,
The 1-by-N-by-D array entry can also specify different fixed initial conditions for every channel; in this case, every 1-by-N entry in the array would be identical, so that the initial conditions for each column are fixed over time.
Initial conditions cannot be specified by full matrices.
Resetting the Delay
The 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:
Rst
port.
Rst
input does one of the following:
Rst
input does one of the following:
Rst
input is a Rising edge or Falling edge (as described above).
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) and the topic on the Simulation Parameters dialog box in the Simulink documentation. |
Examples
The dspafxr
demo illustrates an audio reverberation system built around the Integer Delay block.
Dialog Box
Supported Data Types
Rst
port, which is enabled by the Reset port parameter.
To learn how to convert 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 |
Also see Signal Operations for a list of all the blocks in the Signal Operations library.
![]() | Inherit Complexity | Interpolation | ![]() |