Clear stored information from
View the Dynamic Range of a
NumericTypeScope to view the dynamic range of a
fi object and set the
a = fi(magic(10),1,8,2); b = fi([a; 2.^(-5:4)],1,8,3); fp = fipref; initialDTOSetting = fp.DataTypeOverride; fp.DataTypeOverride = 'ScaledDoubles';
NumericTypeScope object. You can use the
reset method to ensure that all stored information is cleared from the
h = NumericTypeScope; reset(h)
step method to process your data and visualize the dynamic range of the
NumericTypeScope window does not delete the object from your workspace. Close the
NumericTypeScope window and reopen it using the
NumericTypeScope displays a
log2 histogram which shows that the values appear both outside of the range and below the precision of the data type of the variable. Pause on one bar of the histogram to view the percentage of the total values that are represented by that bar.
In this case, the data type of
numerictype(1,8,3) data type provides 5 integer bits, including the signed bit, and 3 fractional bits. Thus, this data type can represent only values between -2^4 and 2^4 - 2^-3 (from -16 to 15.8750). Given the range and precision of this data type, values greater than 2^4 fall outside the range and values less than 2^-3 fall below the precision of the data type.
NumericTypeScope shows that values requiring bits 5, 6, and 7 are outside the range and values requiring fractional bits 4 and 5 are below precision. Given this information, you can prevent values that are outside range and below precision by changing the data type of the variable
Given this information, you can prevent values that are outside range and below precision by changing the data type of the variable
numerictype(0,13,5). In the
numerictype(0,13,5) in the Proposed Data Type box.
Return to the original data type override setting.
fp.DataTypeOverride = initialDTOSetting;
NumericTypeScope object, specified as a
Introduced in R2010a