Documentation

Contents

Sample and Hold

Sample and hold input signal

Library

Signal Operations

dspsigops

Description

The Sample and Hold block acquires the input at the signal port whenever it receives a trigger event at the trigger port (marked by ). The block then holds the output at the acquired input value until the next triggering event occurs.

The trigger input must be a sample-based scalar with sample rate equal to the input frame rate at the signal port. You specify the trigger event using the Trigger type parameter:

  • Rising edge triggers the block to acquire the signal input when the trigger input rises from a negative value or zero to a positive value.

  • Falling edge triggers the block to acquire the signal input when the trigger input falls from a positive value or zero to a negative value.

  • Either edge triggers the block to acquire the signal input when the trigger input either rises from a negative value or zero to a positive value or falls from a positive value or zero to a negative value.

You specify the block's output prior to the first trigger event using the Initial condition parameter. When the acquired input is an M-by-N matrix, the Initial condition can be an M-by-N matrix, or a scalar to be repeated across all elements of the matrix. When the input is a length-M unoriented vector, the Initial condition can be a length-M row or column vector, or a scalar to be repeated across all elements of the vector.

If you select the Latch (buffer) input check box, the block outputs the value of the input from the previous time step until the next triggering event occurs. To use this block in a loop, select this check box.

Dialog Box

Trigger type

The type of event that triggers the block to acquire the input signal.

Initial condition

The block's output prior to the first trigger event.

Latch (buffer) input

If you select this check box, the block outputs the value of the input from the previous time step until the next triggering event occurs.

Supported Data Types

PortSupported Data Types

Input

  • Double-precision floating point

  • Single-precision floating point

  • Fixed point (signed and unsigned)

  • Boolean

  • 8-, 16-, and 32-bit signed integers

  • 8-, 16-, and 32-bit unsigned integers

Trigger

  • Any data type supported by the Trigger block

Outputs

  • Double-precision floating point

  • Single-precision floating point

  • Fixed point (signed and unsigned)

  • Boolean

  • 8-, 16-, and 32-bit signed integers

  • 8-, 16-, and 32-bit unsigned integers

See Also

DownsampleDSP System Toolbox
N-Sample SwitchDSP System Toolbox

Was this topic helpful?