MATLAB's accuracy of digits number
11 次查看(过去 30 天)
显示 更早的评论
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 个评论
Matt Fig
2011-6-22
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
2011-6-22
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.
采纳的回答
the cyclist
2011-6-22
Do you have the Symbolic Math Toolbox? If so, then:
2 个评论
Walter Roberson
2011-6-22
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.
更多回答(4 个)
Fangjun Jiang
2011-6-22
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 个评论
Sean de Wolski
2011-6-22
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
2011-6-25
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)
Paulo Silva
2011-6-22
The Symbolic Math Toolbox™ can handle the 25 digits, some of their functions have default digit number of 32 digits.
2 个评论
Fangjun Jiang
2011-6-22
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
2011-6-22
@Fangjun
http://www.mathworks.com/matlabcentral/fileexchange/22239-num2strexact-exact-version-of-num2str
might interest you.
Dias Papas
2011-6-25
2 个评论
Jan
2011-6-25
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
2014-11-26
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.
Derek O'Connor
2011-6-25
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 个评论
Jan
2011-6-26
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
2011-6-28
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
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!