MATLAB's accuracy of digits number

9 views (last 30 days)
Dias Papas
Dias Papas on 22 Jun 2011
Commented: Alexei on 26 Nov 2014
Hi to everyone,
I am dealing with satellite data with accurancy of 25 digits. As I know MATLAB provides computations with maximum 16 digits (long e format). Is there any way to process these data with 25 digits accuracy, because i dont want these values to be rounded?
Thanks a lot
Diamantes
  3 Comments
Matt Fig
Matt Fig on 22 Jun 2011
Dias, I too doubt the actual accuracy of that many digits. There is a difference between having 25 digits and having 25 useful digits.
MATLAB always uses doubles unless you specify another data type. The display (format long g) has nothing to do with the internal storage. The number is the same no matter how it is displayed in the command window...
the cyclist
the cyclist on 22 Jun 2011
It could be that the each number being sent encode information on more than one variable, with some kind of multiplexing. So, maybe the final digits are not just more precision on the first digits.

Sign in to comment.

Accepted Answer

the cyclist
the cyclist on 22 Jun 2011
Do you have the Symbolic Math Toolbox? If so, then:
  2 Comments
Fangjun Jiang
Fangjun Jiang on 22 Jun 2011
So, can the Symbolic Math Toolbox be used to read in a long precision data?
Walter Roberson
Walter Roberson on 22 Jun 2011
If my memory hasn't slipped a bit: the Maple version of the Symbolic Math Toolbox did not have any file input operations; those were, though, exposed by the Extended Symbolic Math Toolbox.
The MuPad version of the Symbolic Math Toolbox does have file input operations: see http://www.mathworks.com/help/toolbox/mupad/quickref/fileIO.html#fileIO
I do not see there any equivalent of fscanf(). On the other hand, when numbers with large numbers of digits are input, those digits are all preserved... though of course if you then do an arithmetic operation on such a number, the result might be in terms of the current Digits setting.

Sign in to comment.

More Answers (4)

Fangjun Jiang
Fangjun Jiang on 22 Jun 2011
This is a really good question. I like it. Look at the following code:
aStr={'1234567890.12345';
'1234567890.123456';
'1234567890.1234567';
'1234567890.12345678';
'1234567890.123456789'};
aNum=cellfun(@str2double,aStr);
aTF=bsxfun(@eq,aNum,aNum')
aTF =
1 0 0 0 0
0 1 0 0 0
0 0 1 1 1
0 0 1 1 1
0 0 1 1 1
bStr={'0.123456789012345';
'0.1234567890123456';
'0.12345678901234567';
'0.123456789012345678';
'0.1234567890123456789'};
bNum=cellfun(@str2double,bStr);
bTF=bsxfun(@eq,bNum,bNum')
bTF =
1 0 0 0 0
0 1 0 0 0
0 0 1 0 0
0 0 0 1 1
0 0 0 1 1
Questions:
1. What is the number of precision that MATLAB double can distinguish, 16, 17 or 18? The first example above shows 17, the second shows 18.
2. What to do if need to read more number of precision.
  2 Comments
Sean de Wolski
Sean de Wolski on 22 Jun 2011
I personally find it hard to imagine any measurement system that has an SNR high enough to require anything more than floating point precision.
http://en.wikipedia.org/wiki/Pi#Computation_in_the_computer_age
You need 39 digits of pi to measure the observable universe to within the radius of a hydrogen atom.
Malcolm Lidierth
Malcolm Lidierth on 25 Jun 2011
For double precision see http://www.mathworks.com/company/newsletters/news_notes/pdf/Fall96Cleve.pdf
For more digits, you could use java.math.BigDecimal and/or the Apache math BigReals that use them e.g. in MATLAB
java.math.BigDecimal('1').divide(java.math.BigDecimal('3'),10000,java.math.RoundingMode.HALF_EVEN)

Sign in to comment.


Paulo Silva
Paulo Silva on 22 Jun 2011
The Symbolic Math Toolbox™ can handle the 25 digits, some of their functions have default digit number of 32 digits.
  2 Comments
Fangjun Jiang
Fangjun Jiang on 22 Jun 2011
Help me out here, Paulo! When I type digits in my MATLAB command window, it shows 32. But my example below shows otherwise. Any explaination?
Sean de Wolski
Sean de Wolski on 22 Jun 2011
@Fangjun
http://www.mathworks.com/matlabcentral/fileexchange/22239-num2strexact-exact-version-of-num2str
might interest you.

Sign in to comment.


Dias Papas
Dias Papas on 25 Jun 2011
Thanks a lot for your answers. My field, which i use such a number of digits, is satellite orbit determination and gravity field modeling. For example ocean's tide's data are given with 25 digits. Yes, this doesnt mean that all of them are totally useful but they are play their role.
Anyway thanks everyone!
Dias
  2 Comments
Jan
Jan on 25 Jun 2011
This is really strange. Heisenberg's uncertainty principle means, that such an adequate position measurement will yield to an enormous impulse. Even a small and light object as the ocean would explode by trying to measure the position with such an accuracy. Of course there can be a reason for such an accuracy, but at least it cannot be physically motivated.
Alexei
Alexei on 26 Nov 2014
Pretty sure that's not what it means. I'm pretty sure the uncertainty principle means that such an adequate position measurement will yield enormous uncertainty in what the impulse is. The impulse could still be really tiny or zero -- but you would have no idea.

Sign in to comment.


Derek O'Connor
Derek O'Connor on 25 Jun 2011
Here is a quotation from Prof Nick Trefethen FRS, Oxford:
11. No physical constants are known to more than around eleven digits, and no truly scientific problem requires computation with much more precision than this.
I'll repeat the question asked by others here: why do you need (or think you need) 25 decimal digits.
Here is a cognate quotation from Trefethen:
6. If the answer is highly sensitive to perturbations, you have probably asked the wrong question.
These quotations (maxims) can be found at:
This Matlab Newsgroup thread may be useful:
  2 Comments
Jan
Jan on 26 Jun 2011
I see a contradiction between the two statements: Imagine that you want to find out, if an answer is highly sensitive to perturbations of a value, which is known to 11 digits. Therefore you need _some_ more digits, such that the 64bit doubles are a a quite fine choice.
Derek O'Connor
Derek O'Connor on 28 Jun 2011
Jan,
I don't understand why you need more digits. Why not change the last digit of the 11-digit value and see if there is a large change in the answer?
I do not see a contradiction between Maxim 6 and Maxim 11. They are essentially "orthogonal", i.e., independent. Of course, if a problem is ill-conditioned then many digits may be needed to get an exact answer, which seems to contradict maxim 11. But Maxim 6 says that you should not be solving ill-conditioned problems (except as a hobby, maybe).
See the thread in my answer above and pages 8 to 11 in
http://www.scribd.com/doc/26135665/Two-Simple-Statistical-Calculations-and-ClimateGate

Sign in to comment.

Categories

Find more on Mathematics in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!