2.5. Operators

MATLAB operators can be classified mainly into three categories:

  1. Arithmetic operators that perform arithmetic computations like addition, multiplication, etc.

  2. Relational operators that compare operands quantitatively like ‘less than’, ‘not equal to’, etc.

  3. Logical operators that perform logical operations like AND, OR, NOT, etc.

2.5.1. Arithmetic Operators

Let p = 3, q = 2. Arithmetic operators used in MATLAB and the result of the arithmetic expressions formed using arithmetic operators, with these p and q variables, are illustrated in Table 2.1.

Table 2.1. Arithmetic Operators in MATLAB
OperatorOperationAlgebraic FormMATLAB FormResult of Expression
+Additionp + qp + q5
Subtractionpqp - q1
.*Multiplication (Element by element)

Get MATLAB® and Its Applications in Engineering: [Based on MATLAB 7.5 (R2007b)] now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.