what's wrong with 'smooth' and 'find' commands in this code?
Mostrar comentarios más antiguos
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?
Respuesta aceptada
Más respuestas (1)
Jan
el 31 de En. de 2012
0 votos
This is one of the mayn effects of the limited precision of floating point values. See: Answers: Tag=faq6.1.
1 comentario
Taehwan
el 31 de En. de 2012
Categorías
Más información sobre Stair Plots en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!