Documentation

Saturation

Limit range of signal

Library

Discontinuities

Description

The Saturation block imposes upper and lower limits on an input signal.

When the input is...Where...The block output is the...

Within the range specified by the Lower limit and Upper limit parameters

Lower limit ≤ Input value ≤ Upper limitInput value

Less than the Lower limit parameter

Input value < Lower limitLower limit

Greater than the Upper limit parameter

Input value > Upper limitUpper limit

When the Lower limit and Upper limit parameters have the same value, the block output is that value.

Data Type Support

The Saturation block accepts real signals of the following data types:

  • Floating point

  • Built-in integer

  • Fixed point

For more information, see Data Types Supported by Simulink in the Simulink® documentation.

Parameters and Dialog Box

The Main pane of the Saturation block dialog box appears as follows:

The Signal Attributes pane of the Saturation block dialog box appears as follows:

Show data type assistant

Display the Data Type Assistant.

Settings

The Data Type Assistant helps you set the Output data type parameter.

For more information, see Specify Block Output Data Types.

Upper limit

Specify the upper bound on the input signal.

Settings

Default: 0.5

Minimum: value from the Output minimum parameter

Maximum: value from the Output maximum parameter

Tip

  • When the input signal to the Saturation block is above this value, the output of the block is clipped to this value.

  • The Upper limit parameter is converted to the output data type offline using round-to-nearest and saturation.

Command-Line Information

See Block-Specific Parameters for the command-line information.

Lower limit

Specify the lower bound on the input signal.

Settings

Default: -0.5

Minimum: value from the Output minimum parameter

Maximum: value from the Output maximum parameter

Tips

  • When the input signal to the Saturation block is below this value, the output of the block is clipped to this value.

  • The Lower limit parameter is converted to the output data type offline using round-to-nearest and saturation.

Command-Line Information

See Block-Specific Parameters for the command-line information.

Treat as gain when linearizing

Select this parameter to cause the linearization commands to treat the gain as 1

Settings

Default: On

On

Select to cause the linearization commands to treat the gain as 1.

Off

Clear to cause the linearization commands to treat the gain as 0.

Tips

Linearization commands in Simulink software treat this block as a gain in state space.

Command-Line Information

See Block-Specific Parameters for the command-line information.

Enable zero-crossing detection

Select to enable zero-crossing detection. For more information, see Zero-Crossing Detection.

Settings

Default: On

On

Enable zero-crossing detection.

Off

Do not enable zero-crossing detection.

Command-Line Information

Parameter: ZeroCross
Type: string
Value: 'on' | 'off'
Default: 'on'

Sample time (-1 for inherited)

Enter the discrete interval between sample time hits or specify another appropriate sample time such as continuous or inherited.

Settings

Default: -1

By default, the block inherits its sample time based upon the context of the block within the model. To set a different sample time, enter a valid sample time based upon the table in Types of Sample Time.

See also Specify Sample Time in the online documentation for more information.

Command-Line Information

See Block-Specific Parameters for the command-line information.

Lock output data type setting against changes by the fixed-point tools

Select to lock the output data type setting of this block against changes by the Fixed-Point Tool and the Fixed-Point Advisor.

Settings

Default: Off

On

Locks the output data type setting for this block.

Off

Allows the Fixed-Point Tool and the Fixed-Point Advisor to change the output data type setting for this block.

Command-Line Information

Parameter: LockScale
Type: string
Value: 'off' | 'on'
Default: 'off'

See Also

For more information, see Use Lock Output Data Type Setting.

Integer rounding mode

Specify the rounding mode for fixed-point operations.

Settings

Default: Floor

Ceiling

Rounds both positive and negative numbers toward positive infinity. Equivalent to the MATLAB® ceil function.

Convergent

Rounds number to the nearest representable value. If a tie occurs, rounds to the nearest even integer. Equivalent to the Fixed-Point Designer™ convergent function.

Floor

Rounds both positive and negative numbers toward negative infinity. Equivalent to the MATLAB floor function.

Nearest

Rounds number to the nearest representable value. If a tie occurs, rounds toward positive infinity. Equivalent to the Fixed-Point Designer nearest function.

Round

Rounds number to the nearest representable value. If a tie occurs, rounds positive numbers toward positive infinity and rounds negative numbers toward negative infinity. Equivalent to the Fixed-Point Designer round function.

Simplest

Automatically chooses between round toward floor and round toward zero to generate rounding code that is as efficient as possible.

Zero

Rounds number toward zero. Equivalent to the MATLAB fix function.

Command-Line Information

Parameter: RndMeth
Type: string
Value: 'Ceiling' | 'Convergent' | 'Floor' | 'Nearest' | 'Round' | 'Simplest' | 'Zero'
Default: 'Floor'

See Also

For more information, see Rounding in the Fixed-Point Designer documentation.

Output minimum

Lower value of the output range that Simulink checks.

Settings

Default: [] (unspecified)

Specify this number as a finite, real, double, scalar value.

    Note:   If you specify a bus object as the data type for this block, do not set the minimum value for bus data on the block. Simulink ignores this setting. Instead, set the minimum values for bus elements of the bus object specified as the data type. For information on the Minimum parameter for a bus element, see Simulink.BusElement.

Simulink uses the minimum to perform:

    Note:   Output minimum does not saturate or clip the actual output signal. Use the Saturation block instead.

Command-Line Information

Parameter: OutMin
Type: string
Value: '[ ]'
Default: '[ ]'

Output maximum

Upper value of the output range that Simulink checks.

Settings

Default: [] (unspecified)

Specify this number as a finite, real, double, scalar value.

    Note:   If you specify a bus object as the data type for this block, do not set the maximum value for bus data on the block. Simulink ignores this setting. Instead, set the maximum values for bus elements of the bus object specified as the data type. For information on the Maximum parameter for a bus element, see Simulink.BusElement.

Simulink uses the maximum value to perform:

    Note:   Output maximum does not saturate or clip the actual output signal. Use the Saturation block instead.

Command-Line Information

Parameter: OutMax
Type: string
Value: '[ ]'
Default: '[ ]'

Output data type

Specify the output data type.

Settings

Default: Inherit: Same as input

Inherit: Inherit via back propagation

Use data type of the driving block.

Inherit: Same as input

Use data type of input signal.

double

Output data type is double.

single

Output data type is single.

int8

Output data type is int8.

uint8

Output data type is uint8.

int16

Output data type is int16.

uint16

Output data type is uint16.

int32

Output data type is int32.

uint32

Output data type is uint32.

fixdt(1,16,0)

Output data type is fixed point fixdt(1,16,0).

fixdt(1,16,2^0,0)

Output data type is fixed point fixdt(1,16,2^0,0).

<data type expression>

Use a data type object, for example, Simulink.NumericType.

Command-Line Information

See Block-Specific Parameters for the command-line information.

See Also

For more information, see Specify Block Output Data Types.

Mode

Select the category of data to specify.

Settings

Default: Inherit

Inherit

Inheritance rules for data types. Selecting Inherit enables a second menu/text box to the right. Select one of the following choices:

  • Inherit via back propagation

  • Same as input (default)

Built in

Built-in data types. Selecting Built in enables a second menu/text box to the right. Select one of the following choices:

  • double (default)

  • single

  • int8

  • uint8

  • int16

  • uint16

  • int32

  • uint32

Fixed point

Fixed-point data types.

Expression

Expressions that evaluate to data types. Selecting Expression enables a second menu/text box to the right, where you can enter the expression.

Dependency

Clicking the Show data type assistant button enables this parameter.

Command-Line Information

See Block-Specific Parameters for the command-line information.

See Also

See Specify Data Types Using Data Type Assistant.

Signedness

Specify whether you want the fixed-point data as signed or unsigned.

Settings

Default: Signed

Signed

Specify the fixed-point data as signed.

Unsigned

Specify the fixed-point data as unsigned.

Dependencies

Selecting Mode > Fixed point enables this parameter.

See Also

For more information, see Specifying a Fixed-Point Data Type.

Word length

Specify the bit size of the word that holds the quantized integer.

Settings

Default: 16

Minimum: 0

Maximum: 32

Dependencies

Selecting Mode > Fixed point enables this parameter.

See Also

For more information, see Specifying a Fixed-Point Data Type.

Scaling

Specify the method for scaling your fixed-point data to avoid overflow conditions and minimize quantization errors.

Settings

Default: Best precision

Binary point

Specify binary point location.

Slope and bias

Enter slope and bias.

Best precision

Specify best-precision values.

Dependencies

Selecting Mode > Fixed point enables this parameter.

Selecting Binary point enables:

  • Fraction length

  • Calculate Best-Precision Scaling

Selecting Slope and bias enables:

  • Slope

  • Bias

  • Calculate Best-Precision Scaling

See Also

For more information, see Specifying a Fixed-Point Data Type.

Fraction length

Specify fraction length for fixed-point data type.

Settings

Default: 0

Binary points can be positive or negative integers.

Dependencies

Selecting Scaling > Binary point enables this parameter.

See Also

For more information, see Specifying a Fixed-Point Data Type.

Slope

Specify slope for the fixed-point data type.

Settings

Default: 2^0

Specify any positive real number.

Dependencies

Selecting Scaling > Slope and bias enables this parameter.

See Also

For more information, see Specifying a Fixed-Point Data Type.

Bias

Specify bias for the fixed-point data type.

Settings

Default: 0

Specify any real number.

Dependencies

Selecting Scaling > Slope and bias enables this parameter.

See Also

For more information, see Specifying a Fixed-Point Data Type.

Examples

The sldemo_boilersldemo_boiler model shows how you can use the Saturation block.

The Saturation block appears in the Boiler Plant model/digital thermometer/ADC subsystem.

The ADC subsystem digitizes the input analog voltage by:

  • Multiplying the analog voltage by 256/5 with the Gain block

  • Rounding the value to integer floor with the Quantizer block

  • Limiting the output to a maximum of 255 (the largest unsigned 8-bit integer value) with the Saturation block

For more information, see Explore the Fixed-Point "Bang-Bang Control" Model in the Stateflow® documentation.

Characteristics

Direct Feedthrough

Yes

Sample Time

Specified in the Sample time parameter

Scalar Expansion

Yes, of parameters and input

Dimensionalized

Yes

Zero-Crossing Detection

Yes, if enabled.

Was this topic helpful?