Automatically change scaling of fixed-point data types
The autofixexp script automatically changes the scaling for model objects that specify fixed-point data types. However, if an object's Lock output data type setting against changes by the fixed-point tools parameter is selected, the script refrains from scaling that object.
This script collects range data for model objects, either from design minimum and maximum values that objects specify explicitly, or from logged minimum and maximum values that occur during simulation. Based on these values, the tool changes the scaling of fixed-point data types in a model so as to maximize precision and cover the range.
You can specify design minimum and maximum values for model objects using parameters typically titled Output minimum and Output maximum. See Blocks That Allow Signal Range Specification for a list of Simulink® blocks that permit you to specify these values. In the autoscaling procedure that the autofixexp script executes, design minimum and maximum values take precedence over the simulation range.
If you intend to scale fixed-point data types using simulation minimum and maximum values, the script yields meaningful results when exercising the full range of values over which your design is meant to run. Therefore, the simulation you run prior to using autofixexp must simulate your design over its full intended operating range. It is especially important that you use simulation inputs with appropriate speed and amplitude profiles for dynamic systems. The response of a linear dynamic system is frequency dependent. For example, a bandpass filter will show almost no response to very slow and very fast sinusoid inputs, whereas the signal of a sinusoid input with a frequency in the passband will be passed or even significantly amplified. The response of nonlinear dynamic systems can have complicated dependence on both the signal speed and amplitude.
Note: If you already know the simulation range you need to cover, you can use an alternate autoscaling technique described in the fixptbestprec reference page.
To control the parameters associated with automatic scaling, such as safety margins, use the Fixed-Point Tool.
For more information, see Fixed-Point Tool.
To learn how to use the Fixed-Point Tool, refer to Propose Fraction Lengths Using Simulation Range Data.