Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.


Curious
Posts:
2,359
Registered:
12/6/04


Re: if condition problem
Posted:
Feb 5, 2013 12:20 PM


"mado " <elec_mnf@yahoo.com> wrote in message <kera4k$80l$1@newscl01ah.mathworks.com>... > it should give constant value when I=Iold or dI /dV=I/v but it don't , the output is ramp this code is implemented in embedded matlab function > and forgive me i am not professional i couldn't get you , i just want to do this flow chart
It is bad programming practice to compare two floating point numbers for equality. I'm not sure, but I'm guessing that is your problem.
See the MATLAB FAQ at:
<<http://matlab.wikia.com/wiki/FAQ>>
Specifically:
Why is 0.3  0.2  0.1 (or similar) not equal to zero?
for ways to work around this issue.



