Contents

dsp.Delay System object

Package: dsp

Delay input by specified number of samples or frames

Description

The Delay object delays an input by a specified number of samples or frames.

To delay an input by a specified number of samples or frames:

  1. Define and set up your delay object. See Construction.

  2. Call step to delay the input according to the properties of dsp.Delay. The behavior of step is specific to each object in the toolbox.

Construction

H = dsp.Delay returns a delay object, H, to delay the input by one sample.

H = dsp.Delay('PropertyName', PropertyValue, ...) returns a delay object, H, with each property set to the specified value.

H = dsp.Delay(LEN,'PropertyName',PropertyValue, ...) returns a delay object, H, with the Length property set to LEN and other specified properties set to the specified values.

Properties

Units

Delay units as samples or frames

Specify the delay units as one of | Samples | Frames |. This property applies when you set the FrameBasedProcessing property to true. The default is Samples.

Length

Amount of delay

Specify amount of delay to apply to the input signal. You can set this property to a scalar, a vector, or an array containing nonnegative integers depending on the value of the FrameBasedProcessing property.

If the FrameBasedProcessing property is false, the value can be a scalar by which to delay all input channels equally, or an N-D array of the same dimensions as the input whose values specify the number of sample intervals to delay each channel of the input.

If the FrameBasedProcessing property is true, the value can be an integer by which to equally delay all channels or a vector whose length equals the number of input columns (channels).

The default is 1.

InitialConditionsPerChannel

Enable different initial conditions per channel

Set this property to true to specify different initial conditions per channel. The default value is false.

InitialConditionsPerSample

Enable different initial conditions per sample

Set this property to true to specify different initial conditions per sample. The default value is false.

InitialConditions

Initial output of delay object

Specify the initial output(s) of the delay object. You can set this property to a scalar, vector, matrix, or a cell array depending on the values of the FrameBasedProcessing, InitialConditionsPerChannel, InitialConditionsPerSample, and Units properties. The default is 0.

If the FrameBasedProcessing property is false, and the input is an N-D array, the dimensions of this property value have the following requirements:

  • If the InitialConditionsPerChannel and InitialConditionsPerSample properties are both false, the property value must be a scalar. If the InitialConditionsPerChannel property is true and the InitialConditionsPerSample property is false, the value must have the same dimensions as the input. If the InitialConditionsPerChannel property is false and the InitialConditionsPerSample property is true, the value must be a vector of length equal to the Length property value.

  • If the InitialConditionsPerChannel and InitialConditionsPerSample properties are both true, the property value must be a cell array of the same size as the input signal. Each cell of the cell array contains the delay values for one channel, and must be a vector of length equal to the Length property value.

If the FrameBasedProcessing property is true, and the input is an M-by-N matrix, the dimensions of this property value must be as follows:

  • If the InitialConditionsPerChannel and InitialConditionsPerSample properties are both false, the property value must be a scalar.

  • If the InitialConditionsPerChannel property is true and the InitialConditionsPerSample property is false, the value must be a vector of length N.

  • If the InitialConditionsPerChannel property is false, the InitialConditionsPerSample property is true, and the Units property is Frames, the value must be a vector of length equal to the product of M and the Length property value.

  • If the InitialConditionsPerChannel property is false, the InitialConditionsPerSample property is true, and the Units property is Samples, the value must be a vector of length equal to the Length property value.

  • If the InitialConditionsPerChannel and InitialConditionsPerChannel properties are both true, the property value must be a cell array of size N. Each cell of the cell array contains the delay values for one channel.

  • If the Units property is Frames, each cell must be a vector of length equal to the product of M and the Length property value.

  • If the Units property is Samples, each cell must be a vector of length equal to the Length property value.

ResetInputPort

Enable resetting delay states

Specify when the delay object should reset the delay states. By default, the value of this property is false, and the object does not reset the delay states. When this property is set to true, a reset control input is provided to the step method, and the ResetCondition property applies. The object resets the delay states based on the values of the ResetCondition property and the reset input to the step method.

ResetCondition

Reset trigger setting for delay

Specify the event to reset the delay as one of | Rising edge | Falling edge | Either edge | Non-zero |. The delay object resets the delay based on the values of this property and the reset input to the step method. This property applies when you set the ResetInputPort property to true. The default is Non-zero.

FrameBasedProcessing

Enable frame-based processing

Set this property to true to enable frame-based processing. Set this property to false to enable sample-based processing. The default is true.

Methods

cloneCreate delay object with same property values
getNumInputsNumber of expected inputs to step method
getNumOutputsNumber of outputs of step method
isLockedLocked status for input attributes and nontunable properties
releaseAllow property value and input characteristics changes
resetReset delay states
stepApply delay to input

Examples

Delay input by five samples:

hdelay1 = dsp.Delay(5);
% Output is [0 0 0 0 0 1 2 3 4 5]'
y = step(hdelay1, (1:10)'); 

Delay input by one frame:

 hdelay2 = dsp.Delay;
 hdelay2.Units = 'Frames';
 hdelay2.Length = 1;

 % Output is zeros(10,1) 
 y1 = step(hdelay2, (1:10)'); 

 % Output is (1:10)' 
 y2 = step(hdelay2, (11:20)'); 

Algorithms

This object implements the algorithm, inputs, and outputs described on the Delay block reference page. The object properties correspond to the block parameters.

Both this object and its corresponding block let you specify whether to process inputs as individual samples or as frames of data. The object uses the FrameBasedProcessing property. The block uses the Input processing parameter. See Set the FrameBasedProcessing Property of a System object for more information.

Was this topic helpful?