fi objects with singles, doubles, or
scaled doubles. Data type override only occurs when the
function is called. Objects that are created while data type override
is on have the overridden data type. They maintain that data type
when data type override is later turned off. To obtain an object with
a data type that is not the override data type, you must create an
object when data type override is off:
p = fipref('DataTypeOverride', 'TrueDoubles') p = NumberDisplay: 'RealWorldValue' NumericTypeDisplay: 'full' FimathDisplay: 'full' LoggingMode: 'Off' DataTypeOverride: 'TrueDoubles' a = fi(pi) a = 3.1416 DataTypeMode: Double p = fipref('DataTypeOverride', 'ForceOff') p = NumberDisplay: 'RealWorldValue' NumericTypeDisplay: 'full' FimathDisplay: 'full' LoggingMode: 'Off' DataTypeOverride: 'ForceOff' a a = 3.1416 DataTypeMode: Double b = fi(pi) b = 3.1416 DataTypeMode: Fixed-point: binary point scaling Signedness: Signed WordLength: 16 FractionLength: 13
To reset the
fipref object to its default
p is a
This is useful to ensure that data type override and logging are off.
Choosing the scaling for the fixed-point variables in your algorithms can be difficult. In Fixed-Point Designer™ software, you can use a combination of data type override and min/max logging to help you discover the numerical ranges that your fixed-point data types need to cover. These ranges dictate the appropriate scalings for your fixed-point data types. In general, the procedure is
Implement your algorithm using fixed-point
using initial “best guesses” for word lengths and scalings.
Use the information obtained in step 4 to set the fixed-point scaling for each variable in your algorithm such that the full numerical range of each variable is representable by its data type and scaling.
A detailed example of this process is shown in the Fixed-Point Designer Set Data Types Using Min/Max Instrumentation example.