Please help me with this simple problem? Confusing
2 次查看(过去 30 天)
显示 更早的评论
Hey guys, new to forum, would like to ask quick question.
I made the matrix in matlab shown as
>> ref(B)
ans =
1 0 -33/5
0 1 67/5
0 0 0
This is actually the reduced echelon form of matrix.
When I try to make a comparison between ref(B, 1e-15) and ref(B, 1e-16)
it comes out as
>> ref(B, 1e-15)
ans =
1 0 -33/5
0 1 67/5
0 0 0
>> ref(B, 1e-16)
ans =
1 0 0
0 1 0
0 0 1
From this results, I can be certain that the default value for tol (tolerance variable) is smaller than 10e-15 but not smaller than 10e-16.
How do I explain why this is? (the tol seems quite confusing).
thank you guys!!!
1 个评论
Stephen23
2014-9-19
编辑:Stephen23
2014-9-19
If you actually want people who know about this topic to give advice, then try using a more informative question than "Please help me with this simple problem? Confusing" (this could be almost anything...) Your question should give a brief explanation of the topic/area/error/... that you are working with, to help those who might be able to help you.
You should read these pages, which give excellent advice on solving problems in MATLAB, and asking questions here:
回答(4 个)
Iain
2014-9-19
Is the tolerance as simple as being the "epsilon" of the numbers involved?
The machine epsilon is the smallest number that can be added to another. It's normally down at the 15th significant figure.
0 个评论
Stephen23
2014-9-19
编辑:Stephen23
2014-9-19
There is no standard function in MATLAB called ref , so your code does not work (unless you have a custom function called ref ).
If you mean the standard function rref , which calculates the reduced row echelon form of a matrix, then the function help states that it "uses the given tolerance in the rank tests". This essentially means that values <tol will be considered as being equivalent to zero.
2 个评论
Stephen23
2014-9-19
An excellent idea (from Pierre Benoit below) would be to look at the rref code itself, which is apparently an Mfile. Try using a breakpoint, and comparing the two cases.
Yoon
2014-9-19
1 个评论
Image Analyst
2014-9-19
Who are you replying to? Please reply as a "comment" under the answer that you're replying to.
Pierre Benoit
2014-9-19
There is a round-off error in the last column and the last row after the Gauss-Jordan algorithm is used for the first two columns. Therefore, because of your high tolerance, this round-off error is interpreted as a non-negligible number and the result is changed to a matrix with one extra rank (and in your case become regular).
The precision of the machine cannot be infinite ! You have to set your tol (or keep with the default tol, which is safe) in regard of the precision of the machine.
You can check how Rref works since it's just a m.file to see where it's happening.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Entering Commands 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!