| Fixed-Point Blockset | ![]() |
3. Automatic Scaling
Using the automatic scaling procedure, you can easily maximize the precision of the output data type while spanning the full simulation range. For a complex model, the absence of such a procedure can make achieving this goal tedious and time consuming.
Perform automatic scaling for the Controller block. This block is a subsystem representing software running on the target, and requires optimization.
Use local settings. Each subsystem in the model now follows its own independent setting for this parameter.
20. This sets the scaling so that the largest simulation value seen is at least 20% smaller than the maximum value allowed. The Safety margin parameter value multiplies the "raw" simulation values by a factor of 1.2. Setting this parameter to a value greater than 1 decreases the likelihood that an overflow will occur when fixed-point data types are being used.
autofixexp M-file script by clicking the Autoscale Blocks button. This script automatically changes the scaling on all fixed-point blocks that do not have their scaling locked, and that have their output data type specified as a generalized fixed-point number. This script uses the minimum and maximum data logged from the previous simulation to change each block's scaling such that the precision is maximized while the full range of simulation values is spanned for each block.
Note
When you use the automatic scaling tool, the maximum and minimum simulation values must cover the full intended operating range of your design in order for autofixexp to yield meaningful results. Refer to the autofixexp reference page for more information.
|
You can produce a close-up of a portion of the plot by clicking at the upper left of the region you want to expand, and dragging the pointer to the lower right while pressing the mouse button. When you then release the mouse button, you produce the following plot.
Note that a steady state has been achieved, but a small limit cycle is present in the steady state due to poor A/D design.
| 2. Data Type Override | Tutorial: Producing Lookup Table Data | ![]() |
Learn more about the latest releases of MathWorks products: |
| © 1994-2009 The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |