issue in find variable
Info
This question is closed. Reopen it to edit or answer.
Show older comments

2 Comments
Muhammad Usman Gul
on 22 Jul 2020
"Please explain to me why it gives me an empty matrix?"
Read about the behaviors of binary floating point numbers:
This is worth reading as well:
Answers (1)
Fangjun Jiang
on 22 Jul 2020
Edited: Fangjun Jiang
on 22 Jul 2020
floating point data precision issue. Below is an example, a and b are not equal even though all the visible digits are the same.
>> format long
>> a=1-1/3
a =
0.666666666666667
>> b=2/3
b =
0.666666666666667
>> a==b
ans =
logical
0
>> abs(a-b)<=eps
ans =
logical
1
3 Comments
Muhammad Usman Gul
on 22 Jul 2020
Fangjun Jiang
on 22 Jul 2020
find(abs(YouData-0.06)<=eps)
Muhammad Usman Gul
on 22 Jul 2020
This question is closed.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!