please tell me what this words "eps" do in this instruction.i searched it from eps doc but i don't understand the application here.

 채택된 답변

In windows command type
eps
ans =
2.2204e-016eps
eps is a predefined variable

댓글 수: 6

it is an integer?with the value of 2.2204^(-16) @ 2.2204e-016
what's the use specifically?is it ok if i don't put it in the instructions above?
Maybe it's used to indicate an error. If you need it or no, depends on your code.
Let me try to explain eps better. If your code is trying to compare a floating point number to EXACTLY 0.25 then it may not be able to do that. Why not? See the FAQ: http://matlab.wikia.com/wiki/FAQ#Why_is_0.3_-_0.2_-_0.1_.28or_similar.29_not_equal_to_zero.3F? That's why they put a slight tolerance around it to that it can be anything from (.25 minus a tiny amount) to (0.25 plus a tiny amount). I usually use around 10*eps rather than eps because I don't know if it is even possible to GET a number between 0.25 and (0.25+eps) - it may well be impossible, so that's why I use a multiple of eps.
There are three numbers between 0.25 and 0.25+eps, namely 0.25+eps/4, 0.25+2*eps/4, and 0.25+3*eps/4. These can also be written 0.25+eps(0.25), 0.25+2*eps(0.25), and 0.25+3*eps(0.25).
When you see an expression written as (Constant + eps) then often what should have been written is either (Constant + eps(Constant)) or (Constant * (1+eps)) (though the two expressions are not identical if the Constant <= 0)
Suppose you are using a search routine that allows you to provide a lower bound for a value, and it is built in to the search routine that it will allow values that equal that lower bound, but you only want values greater than the lower bound. The trick is to add eps(value) to the value, thus getting "the first representable number greater than the value" as the lower bound that it will actually use.

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

Nikola
Nikola 2015년 3월 11일
so if do: find x(x==0)=eps, it will find all values of x that are very close to zero? what about "-eps"? what does that minus sign change?
Nikola
Nikola 2015년 3월 11일
or it will change all values where x is 0 to very small value?

카테고리

도움말 센터File Exchange에서 Operators and Elementary Operations에 대해 자세히 알아보기

태그

질문:

2013년 3월 24일

답변:

2015년 3월 11일

Community Treasure Hunt

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

Start Hunting!

Translated by