How do I debug "Saturate on overflow detected" warnings from Simulink blocks?

12 views (last 30 days)
I noticed the warning messages like this after running the simulation:
Saturate on overflow detected. This originated from 'model/subsystem/lstm/ForIteratorSubsystem/LSTMCore/LinearGateAdd/Wx+Rh+b'.
Suggested Actions: Suppress.
I can trace back to the source block. I don't want to suppress the warning.
I am interested in how to debug from here.

Accepted Answer

MathWorks Fixed Point Team
Edited: MathWorks Fixed Point Team on 24 Jul 2025
This warning (can be reported as error) indicates that the output signal from this block has exceeded the representable range of its data type, causing saturation. This can occur when using fixed-point, limited-range data types in blocks like the LSTM Layer block.
You can control this diagnostic from a Simulink model using the Saturate on overflow (IntegerSaturationMsg) configuration parameter.
Here are a few approaches to debug the overflow:
  1. Turn on signal logging to record and inspect signal values during simulation. You can enable this by right-clicking the signal line and selecting Log Selected Signals. After simulation, use the Simulation Data Inspector to trace the signal values leading up to the overflow.
  2. Use the Fixed-Point Tool. Open from the tool from the Simulink App gallery or the context menu. Use the Range Collection workflow in the tool to simulate the model and collect min/max values for all signals. The Fixed-Point Tool highlights signals where overflows or saturations occur and the visualizations provide additional details.
  3. Override data types using scaled doubles. To better understand the range requirements, temporarily override all fixed-point data types to use the scaled double data type. This helps you observe the full dynamic range of your signals without quantization effects. In the Fixed-Point Tool, set data type override to scaled doubles, run the simulation, and analyze the collected ranges. For an example, see the Use Custom Data Type Override Settings for Range Collection.

More Answers (0)

Products


Release

R2025a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!