Delay

Delay discrete-time input by specified number of samples or frames

Library

Signal Operations

dspsigops

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. 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.

This block reference contains the following topics:

Sample-Based Operation

When the input is a sample-based N-D array, each sample of the input is treated as an independent channel. Thus, the total number of channels is equal to the product of the input dimensions. The dimension of the output is the same as that of the input.

When the input is a sample-based N-D array, 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 Operation Examples section for more information.

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.

When 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. See the Frame-Based Operation Examples section for more information.

Resetting the Delay

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:

This block supports Simulink virtual buses.

Dialog Box

Delay units

Select whether you want to delay your input by a specified number of 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.

Delay (samples) or Delay (frames)

See Sample-Based Operation and Frame-Based Operation for a description of what format to use for each configuration of the block dialog.

Specify different initial conditions for each channel

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.

Specify different initial conditions within a channel

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.

Initial conditions

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 Operation and Frame-Based Operation for a description of what format to use for each configuration of the block dialog.

Reset port

Determines the reset event that causes the block to reset the delay. For more information, see Resetting the Delay.

Examples

Sample-Based Operation Examples

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:

  1. For the Delay (samples) parameter, type 2.

  2. Clear the Specify different initial conditions for each channel and Specify different initial conditions within a channel check boxes.

  3. For the Initial conditions parameter, specify a scalar value of 0.

    The output of the delay block is

    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 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 sample-based matrix.

You want the initial conditions of your four-channel signal to be

for the first two samples:

  1. For the Delay (samples) parameter, type 2.

  2. Select the Specify different initial conditions for each channel check box.

  3. Clear the Specify different initial conditions within a channel check box.

  4. For the Initial conditions parameter, type [7 9; 11 13].

    The output of the delay block is

    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, 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 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:

  1. For the Delay (samples) parameter, type 2.

  2. Clear the Specify different initial conditions for each channel check box.

  3. Select the Specify different initial conditions within a channel check box.

  4. For the Initial conditions parameter, type [10 20].

    The output of the delay block is

    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.

Case 4 — Use Different Initial Conditions for Each Channel and 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 sample-based vector.

You want the initial conditions of your two channel signal to be different for each channel and along each channel:

  1. For the Delay (samples) parameter, type 2.

  2. Select the Specify different initial conditions for each channel and Specify different initial conditions within a channel check boxes.

  3. For the Initial conditions parameter, type [10 20; 30 40]

    The output of the delay block is

    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:

  1. For the Delay (samples) parameter, type 2.

  2. Select the Specify different initial conditions for each channel and the Specify different initial conditions within a channel check boxes.

  3. For the Initial conditions parameter, type {[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

    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 Examples

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. For the Delay (frames) parameter, type 1.

  2. Clear the Specify different initial conditions for each channel and the Specify different initial conditions within a channel check boxes.

  3. For the Initial conditions parameter, specify a scalar value of 0.

    The output of the delay block is

    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 ≥ 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 frame-based matrix.

You want the initial conditions of your three-channel signal to be [0 10 20] for the first frame:

  1. For the Delay (frames) parameter, type 1.

  2. Select the Specify different initial conditions for each channel check box.

  3. Clear the Specify different initial conditions within a channel check box.

  4. For the Initial conditions parameter, type [0 10 20].

    The output of the delay block is

    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.

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. For the Delay (frame) parameter, type 1.

  2. Clear the Specify different initial conditions for each channel check box.

  3. Select the Specify different initial conditions within a channel check box.

  4. For the Initial conditions parameter, type [10 20 30].

    The output of the delay block is

    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, when 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. For the Delay (frames) parameter, type 1.

  2. Select the Specify different initial conditions for each channel and the Specify different initial conditions within a channel check boxes.

  3. For the Initial conditions parameter, type 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

    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.

Supported Data Types

See Also

Unit DelaySimulink
Variable Fractional DelaySignal Processing Blockset
Variable Integer DelaySignal Processing Blockset

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS