The arguments in a function definition need not be scalar variables. They can also be vectors or matrices. Functions can return values that are scalars, vectors, or matrices.

Figure 10-21 shows some examples of functions with vector and matrix arguments and results

Note that if a function expects a vector or a matrix for an argument, it will not work on a scalar argument. In the example in Figure 10-21, trying to evaluate extent(3) will flag the equation with the an error message indicating that the argument must be an array.

If a function returns a vector or matrix as a result, you use the subscript and superscript operators to extract specific numbers. For example, in Figure 10-21, you could evaluate: