Programming Previous page   Next Page

Operators

The MATLAB operators fall into three categories:

This section also discusses Operator Precedence.

Arithmetic Operators

MATLAB provides these arithmetic operators.

Operator
Description
+
Addition
-
Subtraction
.*
Multiplication
./
Right division
.\
Left division
+
Unary plus
-
Unary minus
:
Colon operator
.^
Power
.'
Transpose
'
Complex conjugate transpose
*
Matrix multiplication
/
Matrix right division
\
Matrix left division
^
Matrix power

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.


Previous page  Special Values Relational Operators Next page

© 1994-2005 The MathWorks, Inc.