Arithmetic Operators 4

  • These generally carry out functions on the individual elements of an array (remember all matrices are arrays but not all arrays are matrices – matrices are 2D arrays). The syntax for these is similar to that of the matrix operators, with the only difference being the inclusion of a . before the operator.
Operator Function
.* Element-by-element product of arrays (must be of similar size)
./ A./B – Element-by-element division of A by B (must be of similar size)
.\ A.\B – Element-by-element division of B by A (must be of similar size)
.^ A.^B – Raises elements of A to the value of corresponding elements of B (must be similar size)

 

1

2 3