The basic problem is that you are attempting two logical relations simultaneously: MATLAB's relational operators are binary operators, so they only support one comparison at once. In summary:
In MATLAB logical relational operators follow the standard rules of operator precedence. Look at this example carefully:
The output is true, so does this mean that 4<2 ? Of course not, we just have to remember the operator precedence rules, just like in high school. This is evaluated according to those rules as:
where
So 3<4<2 is actually equivalent to 1<2, which is of course very true:
Best Answer