Main Content

hdl.TappedDelay

Delay input signal and output all delayed versions

Since R2021a

Description

The hdl.TappedDelay System object™ delays the input by a specified number of samples and outputs all delayed versions. You can choose to output the oldest delay version first or the newest delay version first by setting the DelayOrder property. You can specify the initial output of the object by using the InitialCondition property.

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

  1. Create the hdl.TappedDelay 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.TappedDelay creates a tapped delay System object that delays the input by 4 samples.

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

delay = hdl.TappedDelay(len,Name,Value) creates a tapped delay System object with the NumDelays property set to len, and sets properties using one or more name-value pairs. For example, delay = hdl.TappedDelay(10,'DelayOrder','Newest'); creates a tapped delay object with the number of delays as 10 and that orders the output vector starting with the newest delay version and ending with the oldest delay version.

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.

Data Types: double

Length of each delay element, specified a scalar nonnegative integer. TapLength must be a factor of NumDelays that is less than or equal to NumDelays.

Data Types: double

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

Data Types: double

Whether to output the oldest delay version first or the newest delay version first.

  • 'Oldest' orders the output vector starting with the oldest delay version and ending with the newest delay version.

  • 'Newest' orders the output vector starting with the newest delay version and ending with the oldest delay version.

Data Types: char

Whether to include the current input in output vector, specified as a logical.

  • false does not include the current input in the output vector.

  • true includes the current input in the output vector.

Data Types: logical

Usage

Description

delayOut = delay(dataInput) adds delay to the data input and outputs all delayed versions.

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

All versions of the delayed input signal, returned as a scalar, vector, or matrix. Use the DelayOrder property to specify the order of the delayed signals in the output vector.

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 an input by five samples by using the hdl.TappedDelay System object. By default, hdl.TappedDelay uses initial outputs of 0.

delay = hdl.TappedDelay(5);
for input = 1:5
    delayOut = delay(input)
end
delayOut =

     0
     0
     0
     0
     0


delayOut =

     0
     0
     0
     0
     1


delayOut =

     0
     0
     0
     1
     2


delayOut =

     0
     0
     1
     2
     3


delayOut =

     0
     1
     2
     3
     4

Use the object function reset to reset the delay states.

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

     0
     0
     0
     0
     0


step2 =

     0
     0
     0
     0
     1

Delay an input by ten samples by using the hdl.TappedDelay System object. By default, the TapLength is 1, which creates ten taps. If TapLength is 2, five taps are created.

delay = hdl.TappedDelay(10, 'TapLength', 2);
for input = 1:10
    delayOut = delay(input)'
end
delayOut =

     0     0     0     0     0


delayOut =

     0     0     0     0     0


delayOut =

     0     0     0     0     1


delayOut =

     0     0     0     0     2


delayOut =

     0     0     0     1     3


delayOut =

     0     0     0     2     4


delayOut =

     0     0     1     3     5


delayOut =

     0     0     2     4     6


delayOut =

     0     1     3     5     7


delayOut =

     0     2     4     6     8

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