Inaccurate result when using mod(N,1) or rem(N,1), when N=9/(45*0.0001)
Show older comments
where N = i/(f*ts) : f=45, ts=0.0001, i =9; In this case: N=2000, then in while loop it calculates the remainder: rem(N,1) it must give zero but it gives 1 instead. By the way, I wrote 2000-N which should be zero, it gives me a very small number like -2.273736754432321e-13, this is considered by the remainder function as 1.
1 Comment
Salam Hanna
on 3 Feb 2017
Accepted Answer
More Answers (0)
Categories
Find more on Performance and Memory 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!