what's wrong with 'smooth' and 'find' commands in this code?
Show older comments
x = [0 0 0 1 1 1 0 1 0 0 1 1 1 0 0 0 0];
y = smooth(x,5);
find(y(:) == 0.6)
ans = Empty matrix: 0-by-1
Running above script gives empty matrix though definitely 0.6 elements exit. What have I done wrong?
Accepted Answer
More Answers (1)
Jan
on 31 Jan 2012
0 votes
This is one of the mayn effects of the limited precision of floating point values. See: Answers: Tag=faq6.1.
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!