| Contents | Index |
| On this page… |
|---|
This example demonstrates how to use the Fixed-Point Tool to propose fraction lengths for a model based on the simulation minimum and maximum values captured over multiple simulations.
This example uses the ex_fpt_merge_demo.mdl model.

The model contains a sine wave input and two alternate noise sources, band-limited white noise and random uniform noise. The software converts the sine wave input and selected noise signal to fixed point and then adds them.
The Data Type Conversion block Dbl-to-FixPt1 converts the double-precision noise input to the fixed-point data type fixdt(1,16,15).
The Data Type Conversion block FixPt-to-Dbl2 converts the double-precision sine wave input to the fixed-point data type fixdt(1,16,10).
The Add block Accumulator data type is fixdt(1,32,30) and Output data type is fixdt(1,16,14).
In this example, you use the Fixed-Point Tool to merge the results from two simulation runs. Merging results allows you to autoscale your model over the complete simulation range.
Simulate the Model Using Random Uniform Noise. Using the Fixed-Point Tool, you simulate the model with the random uniform noise signal and observe the simulation minimum and maximum values for the Add block. The Fixed-Point Tool uses these simulation settings:
Fixed-point instrumentation mode: Minimums, maximums and overflows
Data type override: Double
Data type override applies to: All numeric types
Merge instrumentation results from multiple simulations is not selected.
This run provides the simulation results for the random uniform noise input only.
Simulate the Model Using Band-Limited White Noise. You select the band-limited white noise signal and run another simulation using the same Fixed-Point Tool simulation settings. The Fixed-Point Tool overwrites the results of the previous run.
This run provides the simulation range for the band-limited white noise input only.
Merge Results. You configure the Fixed-Point Tool to merge results. Select the random uniform noise input again, rerun the simulation, and observe the simulation results for the Add block.
This run provides the simulation range based on the entire set of input data for both noise sources.
Propose Fraction Lengths Based on Merged Results. The Fixed-Point Tool uses the merged simulation minimum and maximum values to propose scaling for each block to ensure maximum precision while spanning the full range of simulation values.
Open the ex_fpt_merge_demo.mdl model.
From the model main menu, select Tools > Fixed-Point Tool.
On the Fixed-Point Tool Shortcuts to set up runs pane, click the Model-wide double override and full instrumentation button to set:
Data type override to Double. This option enables each of the model's subsystems to use its locally specified data type settings.
Fixed-point instrumentation mode to Minimums, maximums and overflows.
The run name to DoubleOverride.
In the Fixed-Point Tool, click the Simulate button
.
The Simulink software simulates the ex_fpt_merge_demo model, using the random uniform noise signal. Afterward, the Fixed-Point Tool Contents pane displays the simulation results for each block that logged fixed-point data. The tool stores the results in a run named DoubleOverride, denoted by the DoubleOverride label in the Run column.
The SimMin and SimMax values for the Add block are:
SimMin is -3.5822
SimMax is 2.7598
In the model, double-click the switch to select the band-limited white noise signal.
In the Fixed-Point Tool, click the Simulate button.
The Simulink software simulates the ex_fpt_merge_demo model, now using the band-limited white noise signal.
The changed values for SimMin and SimMax for the Add block are:
SimMin is now-2.5317
SimMax is now 3.1542
In the model, double-click the switch to select the random uniform noise signal.
On the Fixed-Point Tool Data collection pane, select Merge instrumentation results from multiple simulations, click Apply and rerun the simulation.
The SimMin and SimMax values for the Add block now cover the entire simulation range for both the random uniform and band-limited white noise signals.
SimMin is -3.5822
SimMax is 3.1542
On the Automatic data typing for selected system pane, click the Propose fraction lengths button.
The Fixed-Point Tool analyzes the data types of all fixed-point blocks whose:
Lock output data type setting against changes by the fixed-point tools parameter is not selected.
Output data type parameter specifies a generalized fixed-point number.
Data types are not inherited.
The Fixed-Point Tool uses the merged minimum and maximum values to propose fraction lengths for each block. These values ensure maximum precision while spanning the full range of simulation values. The tool displays the proposed data types in the Contents pane.

![]() | Propose Word Lengths | Range Analysis | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |