Main Content

How Range Analysis Works

Analyzing a Model with Range Analysis

The model that you want to analyze must be compatible with range analysis. If your model is not compatible, either replace unsupported blocks or divide the model so that you can analyze the parts of the model that are compatible. For more information, see Model Compatibility with Range Analysis.

When you specify Derived ranges as the range collection mode, the Fixed-Point Designer™ software performs a static range analysis of your model to derive minimum and maximum range values for signals in the model. The software analyzes the model behavior and computes the values that can occur during simulation for each block Outport. The range of these values is called a derived range.

The software statically analyzes the ranges of the individual computations in the model based on:

  • Specified design ranges, known as design minimum and maximum values, for example, minimum and maximum values specified for:

    • Inport and Outport blocks

    • Block outputs

    • Input, output, and local data used in MATLAB Function and Stateflow Chart blocks

    • Simulink® data objects (Simulink.Signal and Simulink.Parameter objects)

  • Inputs

  • The semantics of each calculation in the blocks

If the model contains objects that the analysis cannot support, where possible, the software uses automatic stubbing.

The range analysis tries to narrow the derived range by using all the specified design ranges in the model. The more design range information you specify, the more likely the range analysis is to succeed. As the software performs the analysis, it derives new range information for the model. The software then attempts to use this new information, together with the specified ranges, to derive ranges for the remaining objects in the model.

For models that contain floating-point operations, range analysis might report a range that is slightly larger than expected. This difference is due to rounding errors. The software approximates floating-point numbers with infinite-precision rational numbers for analysis and then converts to floating point for reporting.

The following table summarizes how the analysis derives range information and provides links to examples.

When...How the Analysis WorksExamples

You specify design minimum and maximum data for a block output.

The derived range at the block output is based on these specified values and on the following values for blocks connected to its inputs and outputs:

  • Specified minimum and maximum values

  • Derived minimum and maximum values

Only block output signals participate in derived range analysis. If a block has additional data type controls, such as for the accumulator or intermediate results, ranges are not derived for these elements.

Derive Ranges Using Design Ranges

A parameter on a block has initial conditions and a design range.

The analysis takes both factors into account by taking the union of the design range and the initial conditions.

Derive Ranges Using Block Initial Conditions

The model contains a parameter with a specified range and the parameter storage class is set to Auto.

The analysis does not take into account the range specified for the parameter. Instead, it uses the parameter value.

Derive Ranges for Simulink.Parameter Objects

The model contains a parameter with a specified range and the parameter storage class is not set to Auto.

The analysis takes into account the range specified for the parameter and ignores the value.

Derive Ranges for Simulink.Parameter Objects

The model contains insufficient design range information.

The analysis cannot determine derived ranges. Specify more design range information and rerun the analysis.

Troubleshoot Range Analysis of System Objects

The range analysis results might depend on the block sorted order, which determines the order in which the software analyzes the blocks. For more information, see Control and Display Execution Order.

The model contains conflicting design range information.

The analysis cannot determine the derived minimum or derived maximum value for an object. The Fixed-Point Tool generates an error. To fix this error, examine the design ranges specified in the model to identify inconsistent design specifications. Modify them to make them consistent.

Fix Design Range Conflicts

Automatic Stubbing

What is Automatic Stubbing?

Automatic stubbing is when the software considers only the interface of the unsupported objects in a model, not their actual behavior. Automatic stubbing lets you analyze a model that contains objects that the Fixed-Point Designer software does not support. However, if any unsupported model element affects the derivation results, the analysis might achieve only partial results.

How Automatic Stubbing Works

With automatic stubbing, when the range analysis comes to an unsupported block, the software ignores ("stubs") that block. The analysis ignores the behavior of the block. As a result, the block output can take any value.

The software cannot “stub” all Simulink blocks, such as the Integrator block. See the blocks marked “not stubbable” in Simulink Blocks Supported for Range Analysis.

Model Compatibility with Range Analysis

To verify that your model is compatible with range analysis, see:

How to Derive Ranges

  1. Verify that your model is compatible with range analysis.

  2. In Simulink, open your model and set it up for use with the Fixed-Point Tool. For more information, see Set Up the Model.

  3. From the Simulink Apps tab, select Fixed-Point Tool.

  4. In the Fixed-Point Tool, under New, select the Iterative Fixed-Point Conversion workflow.

  5. Under System Under Design (SUD), select the system or subsystem of interest.

  6. Under Range Collection Mode, select Derived ranges as the method of range collection. This configures the model to collect ranges using idealized floating-point data types.

    By default, the tool collects ranges using design information from the system under design. For more information, see Derive Ranges at the Subsystem Level.

  7. Click Prepare to have the Fixed-Point Tool check the system under design for compatibility with the conversion process and report any issues found in the model.

    The Fixed-Point Tool:

    • Checks the model against fixed-point guidelines.

    • Identifies unsupported blocks.

    • Identifies blocks that need design range information.

  8. Click the Collect Ranges button to run the analysis.

    The analysis tries to derive range information for objects in the selected system under design. Your next steps depend on the analysis results.

    Analysis ResultsFixed-Point Tool BehaviorNext StepsFor More Information

    Successfully derives range data for the model.

    Displays the derived minimum and maximum values for the blocks in the selected system.

    Review the derived ranges to determine if the results are suitable for proposing data types. If not, you must specify additional design information and rerun the analysis.

    Derive Ranges Using Design Ranges

    Fails because the model contains blocks that the software does not support.

    Generates an error and provides information about the unsupported blocks.

    To fix the error, review the error message information and replace the unsupported blocks.

    Model Compatibility with Range Analysis

    Cannot derive range data because the model contains conflicting design range information.

    Generates an error.

    To fix this error, examine the design ranges specified in the model to identify inconsistent design specifications. Modify the design ranges to make them consistent.

    Fix Design Range Conflicts

    Cannot derive range data for an object because there is insufficient design range information specified on the model.

    Highlights the results for the object.

    Examine the model to determine which design range information is missing.

    Troubleshoot Range Analysis of System Objects