Programming |

**Operators**

The MATLAB operators fall into three categories:

- Arithmetic Operators perform numeric computations, for example, adding two numbers or raising the elements of an array to a given power.
- Relational Operators compare operands quantitatively, using operators like "less than" and "not equal to."
- Logical Operators use the logical operators AND, OR, and NOT.

This section also discusses Operator Precedence.

MATLAB provides these arithmetic operators.

**Arithmetic Operators and Arrays**

Except for some matrix operators, MATLAB arithmetic operators work on corresponding elements of arrays with equal dimensions. For vectors and rectangular arrays, both operands must be the same size unless one is a scalar. If one operand is a scalar and the other is not, MATLAB applies the scalar to every element of the other operand -- this property is known as *scalar expansion*.

This example uses scalar expansion to compute the product of a scalar operand and a matrix.

Special Values | Relational Operators |

© 1994-2005 The MathWorks, Inc.