How does matlab improve matrix storage accuracy
조회 수: 11 (최근 30일)
이전 댓글 표시
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
답변 (1개)
Walter Roberson
2020년 8월 28일
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.
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!