Main Content

hdl.Delay

Delay input signal by number of samples

Since R2021a

Description

The hdl.Delay System object™ delays the input to the System object by a specified number of samples. You can delay the input along each column for frame-based processing or delay the input for each element for sample-based processing. To select the processing mode, use the InputProcessing property. You can specify the initial output of the object through the InitialConditions property.

To delay the input of the hdl.Delay System object:

  1. Create the hdl.Delay object and set its properties.

  2. Call the object with arguments, as if it were a function.

To learn more about how System objects work, see What Are System Objects?

Creation

Description

delay = hdl.Delay creates a delay System object that delays the input by 1 sample.

delay = hdl.Delay(Name,Value) sets properties using one or more name-value pairs. For example, delay = hdl.Delay('InitialConditions',1); creates a delay object that has an initial output of one.

delay = hdl.Delay(len,Name,Value) creates a delay System object with the Length property set to len, and sets properties using one or more name-value pairs. For example, delay = hdl.Delay(10,'InitialConditions',1,'InputProcessing','SampleBasedProcessing'); creates a delay object that has an initial output of one and uses sampled-based processing.

example

Properties

expand all

Unless otherwise indicated, properties are nontunable, which means you cannot change their values after calling the object. Objects lock when you call them, and the release function unlocks them.

If a property is tunable, you can change its value at any time.

For more information on changing property values, see System Design in MATLAB Using System Objects.

Number of samples by which to delay the input signal, specified as a scalar positive integer.

Initial output of the System object, specified as a scalar.

Input processing mode for the System object, specified as "FrameBasedProcessing" or "SampleBasedProcessing". For more information on frame- and sample-based processing, see Sample- and Frame-Based Concepts (DSP System Toolbox).

Usage

Description

delayOut = delay(dataInput) adds delay to the data input and returns the delayed output.

example

Input Arguments

expand all

Input signal to delay, specified as a scalar, vector, or matrix.

Example: [1;2;3;4;5]

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | logical | fi
Complex Number Support: Yes

Output Arguments

expand all

Delayed output, returned as a scalar, vector, or matrix. The size and data type of the output match the size and data type of the data input.

Example: [0;0;1;2;3]

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | logical | fi
Complex Number Support: Yes

Object Functions

To use an object function, specify the System object as the first input argument. For example, to release system resources of a System object named obj, use this syntax:

release(obj)

expand all

stepRun System object algorithm
releaseRelease resources and allow changes to System object property values and input characteristics
resetReset internal states of System object

Examples

collapse all

Delay input by five samples by using the hdl.Delay System object. By default, hdl.Delay uses frame-based input processing and initial outputs of 0.

delay = hdl.Delay(5);
input = [(1:10)' (11:20)'];
step1 = delay(input)
step1 =

     0     0
     0     0
     0     0
     0     0
     0     0
     1    11
     2    12
     3    13
     4    14
     5    15

Use the object function reset to reset the delay states.

reset(delay);
step1 = delay(input)
step2 = delay(input)
step1 =

     0     0
     0     0
     0     0
     0     0
     0     0
     1    11
     2    12
     3    13
     4    14
     5    15

step2 =

     6    16
     7    17
     8    18
     9    19
    10    20
     1    11
     2    12
     3    13
     4    14
     5    15

Delay input by five samples by using the hdl.Delay System object with sample-based input processing. By default, hdl.Delay uses initial outputs of 0.

With sample-based processing, each element in the input is a channel and is delayed by five samples. As a result, the first five steps each output 0, which is the default initial condition. Step six generates the first non-zero output.

delay = hdl.Delay(5, 'InputProcessing', 'SampleBasedProcessing');
input = [(1:10)' (11:20)'];
step1 = delay(input)
step2 = delay(input)
step3 = delay(input)
step4 = delay(input)
step5 = delay(input)
step6 = delay(input)
step1 =

     0     0
     0     0
     0     0
     0     0
     0     0
     0     0
     0     0
     0     0
     0     0
     0     0


step2 =

     0     0
     0     0
     0     0
     0     0
     0     0
     0     0
     0     0
     0     0
     0     0
     0     0


step3 =

     0     0
     0     0
     0     0
     0     0
     0     0
     0     0
     0     0
     0     0
     0     0
     0     0


step4 =

     0     0
     0     0
     0     0
     0     0
     0     0
     0     0
     0     0
     0     0
     0     0
     0     0


step5 =

     0     0
     0     0
     0     0
     0     0
     0     0
     0     0
     0     0
     0     0
     0     0
     0     0


step6 =

     1    11
     2    12
     3    13
     4    14
     5    15
     6    16
     7    17
     8    18
     9    19
    10    20

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

HDL Code Generation
Generate VHDL, Verilog and SystemVerilog code for FPGA and ASIC designs using HDL Coder™.

Fixed-Point Conversion
Design and simulate fixed-point systems using Fixed-Point Designer™.

Version History

Introduced in R2021a