Why does Stateflow evaluate the condition [x >= (1/2)] differently from [x >= 0.5]?
Mostra commenti meno recenti
I have created a minimal example (available here: http://dl.dropbox.com/u/99981625/fraction_in_condition.mdl) consisting of a single chart with a single state (A) which increments an output variable x in steps of 0.1. A transition from A to A is conditioned on [x >= y], where y is a literal constant. A conditional action resets x to zero. The output variable x is declared as a real double scalar and is given an initial value of zero. If y is the literal "1/2", the condition mysteriously evaluates true even when the debugger shows that x == 0 (or x < 0.5, in general). The conditional action resets the value of x, causing it to remain zero for all time. On the other hand, if y is the literal "0.5", then x increments from 0 to 0.5 before being reset to zero. I expected both conditions to behave as in this second example. Why don't they?
Thanks for any ideas.
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Decision Logic in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!