step
Process data and visualize dynamic range
Syntax
Description
Examples
View the Dynamic Range of a fi
Object
Use the NumericTypeScope
to view the dynamic range of a fi
object.
Create a fi
object and set the DataTypeOverride
to ScaledDoubles
.
a = fi(magic(10),1,8,2);
b = fi([a; 2.^(-5:4)],1,8,3);
fp = fipref;
initialDTOSetting = fp.DataTypeOverride;
fp.DataTypeOverride = 'ScaledDoubles';
Create a NumericTypeScope
object. You can use the reset
method to ensure that all stored information is cleared from the NumericTypeScope
object h
.
h = NumericTypeScope; reset(h)
Use the step
method to process your data and visualize the dynamic range of the fi
object b
.
step(h,b);
Closing the NumericTypeScope
window does not delete the object from your workspace. Close the NumericTypeScope
window and reopen it using the show
function.
show(h);
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 b
is numerictype(1,8,3)
. The 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.
The 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 b
to numerictype(0,13,5)
.
Given this information, you can prevent values that are outside range and below precision by changing the data type of the variable b
to numerictype(0,13,5)
. In the NumericTypeScope
, enter numerictype(0,13,5)
in the Proposed Data Type box.
Return to the original data type override setting.
fp.DataTypeOverride = initialDTOSetting;
Input Arguments
H
— NumericTypeScope
object
NumericTypeScope
object
NumericTypeScope
object, specified as a
NumericTypeScope
object.
Example: step(H,a)
data
— Data to process
fi
object
Data to process, specified as a fi
object.
Example: step(H,a)
Data Types: fi
Version History
Introduced in R2010a
See Also
MATLAB-Befehl
Sie haben auf einen Link geklickt, der diesem MATLAB-Befehl entspricht:
Führen Sie den Befehl durch Eingabe in das MATLAB-Befehlsfenster aus. Webbrowser unterstützen keine MATLAB-Befehle.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)