Main Content

Variable Integer Delay (Obsolete)

Delay input by time-varying integer number of sample periods

Library

dspobslib

  • Variable Integer Delay (Obsolete) block

Description

Note

The Variable Integer Delay block has been replaced with the Simulink Variable Integer Delay (Simulink) block. Existing instances of the DSP block will continue to operate, but certain functionality will be disabled in future releases.

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 sample rate of the input signal at the Delay port must be the same as the sample rate of the input signal at the In port. When these sample rates are not the same, you need to insert a Zero-Order Hold or Rate Transition block in order to make the sample rates identical. When you set the Input processing parameter to Elements as channels (sample based), the delay for an N-D input can be a scalar value to uniformly delay every sample in every channel, or a matrix containing one delay value for each channel of the input. When you set the Input processing parameter to Columns as channels (frame based), the delay 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 Delay block in the following ways.

Variable Integer Delay BlockDelay Block

The delay is provided as an input to the Delay port.

You specify the delay as a parameter setting in the dialog box.

Delay can vary with time; for example, when the block performs frame-based processing, the nth element's delay in the first input frame can differ from the nth element's delay in the second input frame.

Delay cannot vary with time; for example, when the block performs frame-based processing, the nth element's delay is the same for every input frame.

When you use the Variable Integer Delay block in a feedback loop, you must check the Disable direct feedthrough by increasing minimum possible delay by one check box. This prevents the occurrence of an algebraic loop when the delay of the Variable Integer Delay block is driven to zero.

You can use the Delay block to break an algebraic loop.

Sample-Based Processing

When you set the Input processing parameter to Elements as channels (sample based), the Variable Integer Delay block supports N-D input arrays. When the input is an M-by-N-by-P array, the block treats each of the M*N*P elements as independent channels, 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, when 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. When the current input sample is U(1), the previous input sample is U(2), and so on, then the block's output is

y = U(v+1);					% Equivalent MATLAB code

where v is the input to the Delay port. 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 next figure 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.

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 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 in this section 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:

  • Scalar value with which to initialize every sample of every channel in memory. For a general M-by-N input and the parameter settings in this figure,

    the block initializes 100 M-by-N matrices in memory with zeros.

  • Array of size M-by-N-by-D. In this case, you can specify different fixed initial conditions for each channel. See the Array bullet in Time-Varying Initial Conditions below for details.

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:

  • Vector containing D elements with which to initialize memory samples U(2:D+1), where D is the Maximum delay. For a scalar input and the parameters in the next figure, the block initializes U(2:6) with values [-1, -1, -1, 0, 1].

  • Array of dimension M-by-N-by-D with which to initialize memory samples 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 following parameters, the block initializes memory locations U(2:5) with values

    U(2)=[111111], U(3)=[222222], U(4)=[333333], U(5)=[444444]

    An M-by-N-by-P-by-D array can be entered for the Initial Conditions parameter when the input is an M-by-N-by-P array. The (M,N,P,T)th sample of the Initial Conditions matrix provides the initial condition value for the (M,N,P)th channel of the input matrix at delay = Dt+1 samples.

Frame-Based Processing

When you set the Input processing parameter to Columns as channels (frame based), the input can be an M-by-N matrix. The block treats each of the N input columns as independent channels containing M sequential time samples.

In this 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 column vector containing one delay value for each sample in the input frame(s). The set of delays contained in the vector is applied identically to every channel of a multichannel input. The Delay port entry can also be a length-N row vector, containing one delay for each channel. Finally, the Delay port entry can be an M-by-N matrix, containing a different delay for each corresponding element of the input.

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. The samples in each output frame are the values in memory indexed by the elements of v:

y(1) = U(v(1)+1)
y(2) = U(v(2)+1)
y(3) = U(v(3)+1)
y(4) = U(v(4)+1)

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 in this section 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:

  • Scalar value with which to initialize every sample of every channel in memory. For a general M-by-N input with the parameter settings below, the block initializes five samples in memory with zeros.

  • Array of size 1-by-N-by-D. In this case, you can specify different fixed initial conditions for each channel. See the Array bullet in Time-Varying Initial Conditions below for details.

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. When the block is performing frame-based processing, you can specify a time-varying initial condition in the following ways:

  • Vector containing D elements. In this case, all channels have the same set of time-varying initial conditions specified by the entries of the vector. For the ramp input [1:100; 1:100]' with a frame size of 4, delay of 5, and the following parameter settings, the block outputs the following sequence of frames at the start of the simulation:

    [11223344], [55112233], [44556677], 

  • Array of size 1-by-N-by-D. In this case, you can specify different time-varying initial conditions for each channel. For the ramp input [1:100; 1:100]' with a frame size of 4, delay of 5, and the following parameter settings, the block outputs the following sequence of frames at the start of the simulation:

    [111222333444], [555112233], [44556677], 

    By specifying a 1-by-N-by-D initial condition array such that each 1-by-N vector entry is identical, you can implement different fixed initial conditions for each channel.

Examples

See Basic Algorithmic Delay in the DSP System Toolbox™ User's Guide.

Parameters

Maximum delay

The maximum delay that the block can produce for any sample. Delay input values exceeding this maximum are clipped at the maximum.

Initial conditions

The values with which the block's memory is initialized.

Input processing

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.

Disable direct feedthrough by increasing minimum possible delay by one

Select this box to disable direct feedthrough by adding one to the minimum possible delay value. When you set the Input processing parameter to Columns as channels (frame based), the block increases the minimum possible delay value by frame size  – 1. Similarly, when you set the Input processing parameter to Elements as channels (sample based), the block increases the minimum possible delay value by one sample.

Checking this box allows you to use the Variable Integer Delay block in feedback loops.

Supported Data Types

PortSupported Data Types

In

  • 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

Delay

  • Double-precision floating point

  • Single-precision floating point

  • 8-, 16-, and 32-bit signed integers

  • 8-, 16-, and 32-bit unsigned integers

Out

  • 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

See Also

DelayDSP System Toolbox
Variable Fractional DelayDSP System Toolbox

Version History

Introduced in R2014b