Saturation
Limit input signal to the upper and lower saturation values
- Library:
Simulink / Commonly Used Blocks
Simulink / Discontinuities
Description
The Saturation block produces an output signal that is the value of the input signal bounded to the upper and lower saturation values. The upper and lower limits are specified by the parametersUpper limitandLower limit.
Input | Output |
---|---|
Lower limit ≤ Input value ≤ Upper limit | Input value |
Input value < Lower limit | Lower limit |
Input value > Upper limit | Upper limit |
Ports
Input
Port_1
— Input signal
scalar | vector
The input signal to the saturation algorithm.
Data Types:double
|single
|int8
|int16
|int32
|uint8
|uint16
|uint32
|fixed point
Output
Port_1
— Output signal
scalar | vector
Output signal that is the value of the input signal, upper saturation limit, or lower saturation limit.
Data Types:double
|single
|int8
|int16
|int32
|uint8
|uint16
|uint32
|fixed point
Parameters
Main
Upper limit
— Upper saturation boundary for the input signal
0.5
(default) | scalar | vector
Specify the upper bound on the input signal. If the input signal is greater than this boundary, then the output signal is set to this saturation value. TheUpper limitparameter is converted to the output data type using round-to-nearest and saturation.Upper limitmust be greater than theOutput minimumparameter and less than theOutput maximumparameter.
Programmatic Use
Block Parameter:UpperLimit |
Type: character vector |
Value: real scalar or vector |
Default:'0.5' |
Lower limit
— Lower saturation boundary for the input signal
-0.5
(default) | scalar | vector
Specify the lower bound on the input signal. If the input signal is less than this boundary, then the output signal is set to this saturation value. TheLower limitparameter is converted to the output data type using round-to-nearest and saturation.Lower limitmust be greater than theOutput minimumparameter and less than theOutput maximumparameter.
Programmatic Use
Block Parameter:LowerLimit |
Type: character vector |
Value: real scalar or vector |
Default:'-0.5' |
Treat as gain when linearizing
— Specify the gain value
On
(default) | Boolean
Select this check box to cause the commands to treat the gain as 1. The linearization commands in Simulink®software treat this block as a gain in state space. Clear the box to have the commands treat the gain as 0.
Programmatic Use
Block Parameter:LinearizeAsGain |
Type: character vector |
Values:'off' |'on' |
Default:'on' |
Enable zero-crossing detection
— Enable zero-crossing detection
on
(default) | Boolean
Select to enable zero-crossing detection. For more information, seeZero-Crossing Detection.
Programmatic Use
Block Parameter:ZeroCross |
Type: character vector |
Values:'off' |'on' |
Default:'on' |
Sample time
— Specify sample time as a value other than-1
-1
(default) | scalar
Specify the sample time as a value other than -1. For more information, seeSpecify Sample Time.
Dependencies
This parameter is not visible unless it is explicitly set to a value other than-1
. To learn more, seeBlocks for Which Sample Time Is Not Recommended.
Programmatic Use
Block Parameter:SampleTime |
Type:character vector |
Values:scalar |
Default:'-1' |
Signal Attributes
Click theShow data type assistantbuttonto display theData Type Assistant, which helps you set the data type attributes. SeeSpecify Data Types Using Data Type Assistantfor more information.
Output minimum
——最小输出值范围检查
[]
(default) | scalar
Lower value of the output range that Simulink checks.
Simulink uses the minimum to perform:
Parameter range checking (seeSpecify Minimum and Maximum Values for Block Parameters) for some blocks.
Simulation range checking (seeSignal RangesandEnable Simulation Range Checking).
Automatic scaling of fixed-point data types.
Optimization of the code that you generate from the model. This optimization can remove algorithmic code and affect the results of some simulation modes such as SIL or external mode. For more information, seeOptimize using the specified minimum and maximum values(Simulink Coder).
Note
Output minimumdoes not saturate or clip the actual output signal. Use theSaturationblock instead.
Programmatic Use
Block Parameter:OutMin |
Type: character vector |
Values:'[ ]' | scalar |
Default:'[ ]' |
Output maximum
— Maximum output value for range checking
[]
(default) | scalar
Upper value of the output range that Simulink checks.
Simulink uses the maximum value to perform:
Parameter range checking (seeSpecify Minimum and Maximum Values for Block Parameters) for some blocks.
Simulation range checking (seeSignal RangesandEnable Simulation Range Checking).
Automatic scaling of fixed-point data types.
Optimization of the code that you generate from the model. This optimization can remove algorithmic code and affect the results of some simulation modes such as SIL or external mode. For more information, seeOptimize using the specified minimum and maximum values(Simulink Coder).
Note
Output maximumdoes not saturate or clip the actual output signal. Use theSaturationblock instead.
Programmatic Use
Block Parameter:OutMax |
Type: character vector |
Values:'[ ]' | scalar |
Default:'[ ]' |
Output data type
— Specify the output data type
继承:Same as input
(default) |继承:Inherit via back propagation
|double
|single
|int8
|int32
|uint32
|fixdt(1,16,2^0,0)
|
| ...
Choose the data type for the output. The type can be inherited, specified directly, or expressed as a data type object such asSimulink.NumericType
.
Programmatic Use
Block Parameter:OutDataTypeStr |
Type: character vector |
Values:'Inherit: Same as input' ,'Inherit: Inherit via back propagation' ,'single' ,'int8' ,'uint8' ,int16 ,'uint16' ,'int32' ,'uint32' ,fixdt(1,16,0) ,fixdt(1,16,2^0,0) ,fixdt(1,16,2^0,0) .'' |
Default:'Inherit: Same as input' |
Lock output data type setting against changes by the fixed-point tools
— Prevent fixed-point tools from overriding Output data type
off
(default) |on
Select this parameter to prevent the fixed-point tools from overriding theOutputdata type you specify on the block. For more information, seeUse Lock Output Data Type Setting(Fixed-Point Designer).
Programmatic Use
Block Parameter:LockScale |
Type:character vector |
Values:'off' | 'on' |
Default:'off' |
Integer rounding mode
— Specify the rounding mode for fixed-point operations
Floor
(default) |Ceiling
|Convergent
|Nearest
|Round
|Simplest
|Zero
Choose one of these rounding modes.
-
Ceiling
-
Rounds both positive and negative numbers toward positive infinity. Equivalent to the MATLAB®
ceil
function. -
Convergent
-
附近的轮数est 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
-
附近的轮数est representable value. If a tie occurs, rounds toward positive infinity. Equivalent to the Fixed-Point Designer
nearest
function. -
Round
-
附近的轮数est 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.
Programmatic Use
Block Parameter:RndMeth |
Type: character vector |
Values:'Ceiling' |'Convergent' |'Floor' |'Nearest' |'Round' |'Simplest' |'Zero' |
Default:'Floor' |
See Also
For more information, seeRounding(Fixed-Point Designer).
Model Examples
Block Characteristics
Data Types |
|
多维信号 |
|
Variable-Size Signals |
|
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
HDL Code Generation
Generate Verilog and VHDL code for FPGA and ASIC designs using HDL Coder™.
For more information on HDL code generation, seeSaturation.
PLC Code Generation
Generate Structured Text code using Simulink® PLC Coder™.
Fixed-Point Conversion
Convert floating-point algorithms to fixed point using Fixed-Point Designer™.
See Also
Introduced before R2006a
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.
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:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
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
- United Kingdom(English)