Mathematical symbols in MATLAB

As we have just seen, the simplest mathematical operators are represented by the following symbols.

 

Symbol Operator Order Order of Priority
^ Raise to a power 1 evaluated first
* Multiplication 2 evaluated after any powers
/ Division 2 evaluated after any powers
+ Addition 3 evaluated after any powers, multiplication and division
- Subtraction 3 evaluated after any powers, multiplication and division

Order of Operation

Operation order of Priority

  • The power operator has the highest order of priority.
  • Multiplication and division both have equal 2nd order of priority.
  • Addition and subtraction both have equal 3rd order of priority.

‘Left-to-right’ rule

Expressions are evaluated from left to right: the leftmost operation is performed first and the rightmost operation is performed last. However, note that the operator order of priority supersedes the above left-to-right rule.

Brackets

Round brackets, ( ), can be used to change the order of operations: any expression enclosed in brackets will be calculated first