How can I perform computation in single precision or integer arithmetic in MATLAB?
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
MathWorks Support Team
il 27 Giu 2009
Modificato: MathWorks Support Team
il 18 Apr 2023
I would like to use MATLAB to perform computation in single precision or integer arithmetic.
Risposta accettata
MathWorks Support Team
il 20 Feb 2023
Modificato: MathWorks Support Team
il 18 Apr 2023
Starting from MATLAB 7.0 (R14), MATLAB supports several data types that you can assign to numbers or numerical variables on which you can perform arithmetic operations.
There are several functions across various toolboxes that are overloaded to handle single precision numbers. There is no listing of these functions though as they keep changing over time with the addition of new features in MATLAB.
There is a demo on single precision math and integer math available in MATLAB 7.0 (R14) onward that illustrates the use of single precision and integer arithmetic respectively. To run these demos, type:
singleMath
or
integerMath
at the MATLAB Command Prompt. You can also follow the link that appears at the Command Prompt after running the above demos for a published version of the demos.
For more information on these nondouble datatypes and the many operations that are overloaded for nondouble datatypes, refer to the Release Notes of MATLAB 7.0 (R14) and onwards.
If you are using a version prior to MATLAB 7.0 (R14), read the following:
MATLAB performs all operations in double precision floating point following the IEEE 754 standard. However, you can write your own classes or objects to force MATLAB to perform in single precision; see the chapter on Classes and Objects in the Using MATLAB Guide. You may also want to try using the SINGLE function to convert your data to single precision, however no built-in math operations will work on Single Precision data. Type, "help single" in MATLAB for more information.
You may consider searching on the user-based group:
This is a MATLAB user-based newsgroup viewed by thousands daily. It is likely that someone there may have experience with this application.
If you are interested in creating applications and simulations that require single precision (real time applications in chip, for example) , you might consider using the Fixed-Point Toolbox or Fixed-Point Blockset. For more information, refer to the documentation of the Fixed-Point Toolbox or Blockset.
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Logical in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!