Main Content

Interval Test Dynamic

Determine if signal is in specified interval

  • Interval Test Dynamic block

Libraries:
Simulink / Logic and Bit Operations

Description

The Interval Test Dynamic block outputs true (1) if the input is between the values of the external signals up and lo. The block outputs false (0) if the input is outside those values. To control how the block handles input values that are equal to the signal lo or the signal up, use the Interval closed on left and Interval closed on right check boxes.

Examples

expand all

This example shows how to detect when an input signal falls within a dynamically specified interval. The interval is defined by two Sine Wave blocks. When the input to the Interval Test Dynamic block falls between those sine waves, the Interval Test Dynamic block outputs true (1).

Ports

Input

expand all

Upper limit of interval, specified as a scalar, vector, matrix, or N-D array.

Limitations

When the input signal is an enumerated type, the up and lo signals must be of the same enumerated type.

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

Input signal, specified as a scalar, vector, matrix, or N-D array.

Limitations

When the input signal is an enumerated type, the up and lo signals must be of the same enumerated type.

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

Lower limit of interval, specified as a scalar, vector, matrix, or N-D array.

Limitations

When the input signal is an enumerated type, the up and lo signals must be of the same enumerated type.

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

Output

expand all

Output signal indicating whether the input values fall within the specified interval. You can specify the Output data type as boolean or uint8.

Data Types: uint8 | Boolean

Parameters

expand all

When you select this check box, the value of the signal connected to the up input port is included in the interval for which the block outputs true (1).

Programmatic Use

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

When you select this check box, the value of the signal connected to the lo input port is included in the interval for which the block outputs true (1).

Programmatic Use

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

Specify the output data type as boolean or uint8.

Programmatic Use

Block Parameter: OutDataTypeStr
Type: character vector
Values: 'boolean' | 'uint8'
Default: 'boolean'

Block Characteristics

Data Types

Boolean | double | enumerated | fixed point | integer | single

Direct Feedthrough

yes

Multidimensional Signals

yes

Variable-Size Signals

no

Zero-Crossing Detection

no

Extended Capabilities

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

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