How does matlab improve matrix storage accuracy
11 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi,everyone,I encountered a problem. The number in a matrix is too large and exceeds the storage space of 16 bits. I want to expand the storage space of the matrix. It is best if it can be expanded to 200 bits. I know that the vpa function can help us perform high-precision simple operations, but storing high-precision data in a matrix will store double type data by default. Is there any way to expand the number stored in the matrix to 200 digits? The amount of calculation is not a problem.

this is a 10 order martix.
i need calculate 20 order martix.the maximum date of the 20 order martix can reach 10 to the 200th power
0 Kommentare
Antworten (1)
Walter Roberson
am 28 Aug. 2020
storing high-precision data in a matrix will store double type data by default.
The data type of an array is determined by the first value you store to the array.
If you initialize the array
M = zeros(10,10);
then that creates M as a double precision array, and if you attempt to store a symbolic number into part of M, then the symbolic number will be converted to double precision.
So instead initialize the array as symbolic:
M = zeros(10, 10, 'sym');
After which, for example,
M(1,1) = vpa(exp(sym(pi)),200);
Note that the full 200 digits will not be displayed, but you can tell with calculations that they are stored internally.
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!