The documentation states:

Precedence levels determine the order in which MATLAB evaluates an expression. Within each precedence level, operators have equal precedence and are evaluated from left to right.

MATLAB uses the standard order of operations. The precedence rules for MATLAB are listed below, ordered from highest to lowest precedence level.

1) Parentheses ()

2) Transpose (.'), power (.^), complex conjugate transpose ('), matrix power (^)

3) Unary plus (+), unary minus (-), logical negation (~)

4) Multiplication (.*), right division (./), left division (.\), matrix multiplication (*), matrix right division (/), matrix left division (\)

5) Addition (+), subtraction (-)

6) Colon operator (:)

7) Less than (<), less than or equal to (<=), greater than (>), greater than or equal to (>=), equal to (==), not equal to (~=)

8) Element-wise AND (&)

9) Element-wise OR (|)

10) Short-circuit AND (&&)

11) Short-circuit OR ()

While performing parsing at the MATLAB command prompt, operators are given preference over the number. It should also be noted that for single unary operators like (+) or (-) to have precedence over a (^), they should be enclosed in parenthesis ().

For example:

would give precedence to the (-) operator yielding the following output:

## Best Answer