Is it posible to change the number of digits Matlab works with?

3 ビュー (過去 30 日間)
Gianni
Gianni 2021 年 9 月 25 日
回答済み: Walter Roberson 2021 年 9 月 26 日
I´m using the QuTip toolbox to generate random density matrices. These have the strandard 16 digits. However, i would like them to only have 5 so i can export them easly, without having to round them, losing imformation. Maybe there's a better way of doing what i need.

採用された回答

Walter Roberson
Walter Roberson 2021 年 9 月 26 日
You would have to use the Fixed Point Toolbox. This might require some modifications to QuTip toolbox; Fixed Point Designer would help with that.
You could also consider taking the generated matrices and
M = floor(M * 1e5)/1e5;
Reminder, though: Double precision floating point numbers cannot exactly represent 1e-5 so a number such as 0.34567 is going to be rounded by MATLAB, because internally it is represented as a value equal to 0.345669999999999977280396024070796556770801544189453125

その他の回答 (1 件)

KSSV
KSSV 2021 年 9 月 26 日
You can convert them from double to single. Read about the function single. Also have a look on the function format.

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

製品


リリース

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by