MATLAB: ‘logical’ discrepancy

falselogical?

Dear MATLAB community,
I am running 'if' statement and encounter a problem as such:
The logical returns 'false', but the values themselves do equilibrate. Confused.
Thanks,

Best Answer

I can’t run your code because I don’t have the data. however I believe you’re encountering a problem with Operator Precedence. The equality up to the or operator is being evaluated as a single expression, and then being compared to ‘cosd(theta)’.
Judicious use of parentheses could resolve that, but given the structure of the line you quote, I make no guarantees.
Related Question