DSP Blockset | ![]() ![]() |
Delay the input by a time-varying integer number of sample periods.
Library
Description
The Variable Integer Delay block delays the discrete-time input at the In
port by the integer number of sample intervals specified by the input to the Delay
port. The Delay
port input rate must be an integer multiple of the In
port input rate. The delay for a sample-based input sequence is a scalar value to uniformly delay every channel. The delay for a frame-based input sequence can be a scalar value to uniformly delay every sample in every channel, a vector containing one delay value for each sample in the input frame, or a vector containing one delay value for each channel in the input frame.
The delay values should be in the range of 0 to D, where D is the Maximum delay. Delay values greater than D or less than 0 are clipped to those respective values and noninteger delays are rounded to the nearest integer value.
The Variable Integer Delay block differs from the Integer Delay block in the following ways.
Sample-Based Operation
When the input is an M-by-N sample-based matrix, the block treats each of the M*N matrix elements as an independent channel, and applies the delay at the Delay
port to each channel.
The Variable Integer Delay block stores the D+1 most recent samples received at the In
port for each channel. At each sample time the block outputs the stored sample(s) indexed by the input to the Delay
port.
For example, if the input to the In
port, u
, is a scalar signal, the block stores a vector, U
, of the D+1 most recent signal samples. If the current input sample is U(1)
, the previous input sample is U(2)
, and so on, then the block's output is
where v
is the input to the Delay
port. Note that a delay value of 0 (v
=0) causes the block to pass through the sample at the In
port in the same simulation step that it is received. The block's memory is initialized to the Initial conditions value at the start of the simulation (see below).
The figure below shows the block output for a scalar ramp sequence at the In
port, a Maximum delay of 5, an Initial conditions of 0, and a variety of different delays at the Delay
port.
Note that the current input at each time-step is immediately stored in memory as U(1)
. This allows the current input to be available at the output for a delay of 0 (v
=0).
The Initial conditions parameter specifies the values in the block's memory at the start of the simulation. Unlike the Integer Delay block, the Variable Integer Delay block does not have a fixed initial delay period during which the initial conditions appear at the output. Instead, the initial conditions are propagated to the output only when they are indexed in memory by the value at the Delay
port. Both fixed and time-varying initial conditions can be specified in a variety of ways to suit the dimensions of the input sequence.
Fixed Initial Conditions. The settings shown below specify fixed initial conditions. For a fixed initial condition, the block initializes each of D samples in memory to the value entered in the Initial conditions parameter. A fixed initial condition in sample-based mode can be specified in one of the following ways:
Initial conditions cannot be specified by full matrices.
Time-Varying Initial Conditions. The following settings specify time-varying initial conditions. For a time-varying initial condition, the block initializes each of D samples in memory to one of the values entered in the Initial conditions parameter. This allows you to specify a unique output value for each sample in memory. A time-varying initial condition in sample-based mode can be specified in one of the following ways:
U(2:D+1)
, where D is the Maximum delay. For a scalar input and the parameters shown below,
U(2:D+1)
, where D is the Maximum delay and M and N are the number of rows and columns, respectively, in the input matrix. For a 2-by-3 input and the parameters below,
An array initial condition can only be used with matrix inputs.
Initial conditions cannot be specified by full matrices.
Frame-Based Operation
When the input is an M-by-N frame-based matrix, the block treats each of the N input columns as a frame containing M sequential time samples from an independent channel.
In frame-based mode, the input at the Delay
port can be a scalar value to uniformly delay every sample in every channel. It can also be a length-M vector, v = [v(1) v(2) ... v(M)]
, containing one delay for each sample in the input frame(s). The set of delays contained in vector v
is applied identically to every channel of a multichannel input. The Delay
port entry can also be a length-N vector, containing one delay for each channel.
Vector v
does not specify when the samples in the current input frame will appear in the output. Rather, v
indicates which previous input samples (stored in memory) should be included in the current output frame. The first sample in the current output frame is the input sample v(1)
intervals earlier in the sequence, the second sample in the current output frame is the input sample v(2)
intervals earlier in the sequence, and so on.
The illustration below shows how this works for an input with a sample period of 1 and frame size of 4. The Maximum delay (Dmax
) is 5, and the Initial conditions parameter is set to -1. The delay input changes from [1 3 0 5]
to [2 0 0 2]
after the second input frame. Note that the samples in each output frame are the values in memory indexed by the elements of v
.
The Initial conditions parameter specifies the values in the block's memory at the start of the simulation. Both fixed and time-varying initial conditions can be specified.
Fixed Initial Conditions. The settings shown below specify fixed initial conditions. For a fixed initial condition, the block initializes each of D samples in memory to the value entered in the Initial conditions parameter. 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 setting specifies a time-varying initial condition. For a time-varying initial condition, the block initializes each of D samples in memory to one of the values entered in the Initial conditions parameter. This allows you to specify a unique output value for each sample in memory. A time-varying initial condition in frame-based mode can be specified in the following way:
[100; 100]'
with a frame size of 4, delay of 5, and the parameter settings below,
[100; 100]'
with a frame size of 4, delay of 5, and the parameter settings below,
Initial conditions cannot be specified by full matrices.
Dialog Box
Supported Data Types
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
Integer Delay |
DSP Blockset |
Variable Fractional Delay |
DSP Blockset |
Also see Signal Operations for a list of all the blocks in the Signal Operations library.
![]() | Variable Fractional Delay | Variable Selector | ![]() |