Why does Matlab add digits to a code generated vector?
Afficher commentaires plus anciens
I have a simple command that is creating a vector. Test = (51.7:.1:130)' I then iterate through this vector and use the values to search in a list of data that I have. What I find, is that Matlab is actually adding very small numbers to the end of some of my values. For instance 65.5 truly equals 65.500000... However, 65.6 (when you double click) equals 65.600000000000010
I can not think of a logical reason for this behavior. Now, I certainly can go ahead and round the vector before I loop, but that shouldn't be necessary. I'd like to understand why it can't create the vector that I specified.
Thanks for your help, Brian
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Logical dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!