You are bumping into issues with floating point accuracy. Loren has a nice blog post about accuracy with floating point numbers. You can get the result directly from the MAX command using the form that returns both the numerical and index results: Note that with [C,I] = max(...) if there are several identical maximum values, the index of the first one found is returned.
If you want to use find or need to use find because you expect more than 1 occurrence of the maximum, you'll need to take some approach that either brackets the number you are looking for or programatically gives you the exact floating point representation you are looking for.
For example:
a = [1 2 3 .3501/10 4];
myMin = min(a)
find(a == myMin)
or for other sorts of problems you may want to bracket like:
1 Comment
Direct link to this comment
https://de.mathworks.com/matlabcentral/answers/542-the-find-command-returns-an-empty-matrix-for-a-number-i-know-exists#comment_175847
Direct link to this comment
https://de.mathworks.com/matlabcentral/answers/542-the-find-command-returns-an-empty-matrix-for-a-number-i-know-exists#comment_175847
Sign in to comment.