Delay signal one sample period (2024)

Delay signal one sample period

expand all in page

  • Delay signal one sample period (1)

Libraries:
Simulink / Discrete
HDL Coder / Discrete

Description

The Unit Delay block holds and delays its input by the sample periodyou specify. When placed in an iterator subsystem, it holds and delays its input by oneiteration. This block is equivalent to the z-1 discrete-timeoperator. The block accepts one input and generates one output. Each signal can bescalar or vector. If the input is a vector, the block holds and delays all elements ofthe vector by the same sample period.

You specify the block output for the first sampling period with the Initialconditions parameter. Careful selection of this parameter can minimizeunwanted output behavior. You specify the time between samples with the Sampletime parameter. A setting of -1 means the blockinherits the Sample time.

Note

The Unit Delay block errors out if you use it to create atransition between blocks operating at different sample rates. Use the Rate Transition blockinstead.

Comparison with Similar Blocks

The Memory, Unit Delay, and Zero-Order Hold blocks provide similar functionality but have different capabilities. Also, the purpose of each block is different.

This table shows recommended usage for each block.

BlockPurpose of the BlockReference Examples
Unit DelayImplement a delay using a discrete sample time that you specify. The block accepts and outputs signals with a discrete sample time.
  • Engine Timing Model with Closed Loop Control (Compression subsystem)

MemoryImplement a delay by one major integration time step. Ideally, the block accepts continuous (or fixed in minor time step) signals and outputs a signal that is fixed in minor time step.
  • Building a Clutch Lock-Up Model (Friction Mode Logic/Lockup FSM subsystem)

  • Capture the Velocity of a Bouncing Ball with the Memory Block

Zero-Order HoldConvert an input signal with a continuous sample time to an output signal with a discrete sample time.
  • Developing the Apollo Lunar Module Digital Autopilot

  • Radar Tracking Using MATLAB Function Blocks

Each block has the following capabilities.

CapabilityMemoryUnit DelayZero-Order Hold
Specification of initial conditionYesYesNo, because the block output at time t = 0 must match the input value.
Specification of sample timeNo, because the block can only inherit sample time from the driving block or the solver used for the entire model.YesYes
Support for frame-based signalsNo YesYes
Support for state loggingNoYesNo

String Support

The Unit Delay block can accept and output string data type only ifthe block is configured for the default value of the Initialcondition parameter (0).

Examples

Engine Timing Model with Closed Loop ControlEnhance a version of the open-loop engine model described in Model Engine Timing Using Triggered Subsystems. This model, sldemo_enginewc, contains a closed-loop and shows the flexibility and extensibility of Simulink® models. In this enhanced model, the objective of the controller is to regulate engine speed with a fast throttle actuator, such that changes in load torque have minimal effect. This is easily accomplished in Simulink by adding a discrete-time PI controller to the engine model.

Open Model

Ports

Input

expand all

Input signal that the block delays by one sample period.

Data Types: half | single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | string | Boolean | fixed point | enumerated | bus | image

Output

expand all

Output signal that is the input delayed by one sample period.

Data Types: half | single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | string | Boolean | fixed point | enumerated | bus | image

Parameters

expand all

Main

Specify the output of the simulation for the first sampling period,during which the output of the Unit Delay block isotherwise undefined.

Programmatic Use

Block Parameter:InitialCondition
Type: charactervector
Value: scalar |vector
Default:'0'

Specify whether the block performs sample- or frame-based processing:

  • Columns as channels (frame based) — Treat each column of the input as a separate channel (frame-based processing).

    Note

    Frame-based processing requires a DSP System Toolbox™ license.

    For more information, see Sample- and Frame-Based Concepts (DSP System Toolbox).

  • Elements as channels (sample based) — Treat each element of the input as a separate channel (sample-based processing).

Use Input processing to specify whether the block performs sample- or frame-based processing. For more information about these two processing modes, see Sample- and Frame-Based Concepts (DSP System Toolbox).

Programmatic Use

Block Parameter: InputProcessing
Type: character vector
Values: 'Columns as channels (frame based)' | 'Elements as channels (sample based)'
Default: 'Elements as channels (sample based)'

Enter the discrete interval between sample time hits or specify-1 to inherit the sample time.

See also Specify Sample Time.

Programmatic Use

Block Parameter:SampleTime
Type: charactervector
Value: real scalar
Default:'-1'

State Attributes

Use this parameter to assign a unique name to the block state. The default is ' '. When this field is blank, no name is assigned. When using this parameter, remember these considerations:

  • A valid identifier starts with an alphabetic or underscore character, followed by alphanumeric or underscore characters.

  • The state name applies only to the selected block.

This parameter enables State name must resolve to Simulink signal object when you click Apply.

For more information, see C Data Code Interface Configuration for Model Interface Elements (Simulink Coder).

Programmatic Use

Block Parameter: StateName
Type: character vector
Values: unique name
Default: ''

Specify whether state names are required to resolve to signal objects. If selected, the software generates an error at run time if you specify a state name that does not match the name of a signal object.

Selecting this parameter disables the Code generation storage class parameter.

Dependencies

Enabled when you specify a value for the State name parameter and set the Signal resolution model configuration parameter to a value other than None.

Programmatic Use

Block Parameter: StateMustResolveToSignalObject
Type: character vector
Values: 'off' | 'on'
Default: 'off'

Block Characteristics

Data Types

Boolean | bus | double | enumerated | fixed point | half | image | integer | single | string

Direct Feedthrough

noa

Multidimensional Signals

yes

Variable-Size Signals

yes

Zero-Crossing Detection

no

aPorts of this block have different direct feedthrough characteristics.

Extended Capabilities

Generated code relies on memcpy or memsetfunctions (strong.h) under certain conditions.

PLC Code Generation
Generate Structured Text code using Simulink® PLC Coder™.

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

Version History

Introduced before R2006a

See Also

Delay | PropagationDelay | Resettable Delay

MATLAB Command

You clicked a link that corresponds to this MATLAB command:

 

Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.

Delay signal one sample period (3)

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

Americas

  • América Latina (Español)
  • Canada (English)
  • United States (English)

Europe

  • Belgium (English)
  • Denmark (English)
  • Deutschland (Deutsch)
  • España (Español)
  • Finland (English)
  • France (Français)
  • Ireland (English)
  • Italia (Italiano)
  • Luxembourg (English)
  • Netherlands (English)
  • Norway (English)
  • Österreich (Deutsch)
  • Portugal (English)
  • Sweden (English)
  • Switzerland
    • Deutsch
    • English
    • Français
  • United Kingdom (English)

Asia Pacific

Contact your local office

Delay signal one sample period (2024)
Top Articles
Latest Posts
Article information

Author: Patricia Veum II

Last Updated:

Views: 6513

Rating: 4.3 / 5 (64 voted)

Reviews: 95% of readers found this page helpful

Author information

Name: Patricia Veum II

Birthday: 1994-12-16

Address: 2064 Little Summit, Goldieton, MS 97651-0862

Phone: +6873952696715

Job: Principal Officer

Hobby: Rafting, Cabaret, Candle making, Jigsaw puzzles, Inline skating, Magic, Graffiti

Introduction: My name is Patricia Veum II, I am a vast, combative, smiling, famous, inexpensive, zealous, sparkling person who loves writing and wants to share my knowledge and understanding with you.