The maximum of the arguments. |
||
Syntax |
m,i = Max(a) m = Max(a, b) m = Max(a, [], dim) m,i = Max(a, [], dim) (NOTE: the "i" is optional). |
|
Arguments |
Name |
Description |
a |
A vector or a matrix. It can also be a scalar when there are two arguments. |
|
b |
A scalar, vector, or matrix. |
|
dim |
The dimension along which to find the maxima. For columns, dim = 1, and for rows, dim = 2. In the first form, dim is assumed to equal 1. |
|
Output |
Name |
Description |
|
m |
For two scalar inputs, it is the maximum of the two. For a single vector input, it is the maximum of the entries. For a single matrix input, the maximum of each row or column is returned in a vector, depending on the value of dim. For two matrix inputs, it is a matrix of the same size containing the maximum of each pair of elements. When a matrix is compared to a scalar, the scalar is treated as a matrix of elements equal to the scalar. |
|
i |
For vector inputs, the index to the maximum value is returned. For matrix inputs, the indices of the rows or columns (depending on the value of dim) containing the maximum values are returned. |
Example |
Find the maximum of elements in a matrix: |
|
Syntax |
||
M,I = Max([1,2;3,-4]) |
||
Result |
||
M = 3 2 I = 2 1 |
||
Comments |
When the data is complex, it is compared by magnitude. Values of equal magnitude are then compared by phase. This can lead to unexpected results with respect to values with zero imaginary components. |
|
See Also: |