MOTDSP566 Blockset |
|
Search Help Desk |
MOTDSP566 Maximum | Contents See Also |
Purpose
Find the maximum value of one or two input vector(s).
Library
Motdsp566lib
Description
The MOTDSP566 Maximum block identifies the value and position of the largest element in the input.
If the block has two input vectors, the block performs an element-by-element comparison of the input vectors. Each element of the block output vector is the result of the comparison of the elements of the input vectors.
If the block has only one input vector, the Mode parameter specifies the block's mode of operation and can be set to Value, Index, or Value and Index. These settings are described below.
Value
When Mode is set to Value, the block computes the maximum value of the input vector.
[y,i] = mot566_max(u(:)) % equivalent MATLAB code
The block output, y, is the maximum value of the input vector. For complex inputs
the block uses the magnitude of the input, abs(u(:))
, to identify the
maximum. The output is the corresponding complex value from the input.
Index
When Mode is set to Index, the block performs the
computation shown above, and outputs the index, i, corresponding to the position
of the maximum value in the input vector. The index is an integer in the range [1 length(u(:))]
.
If there are duplicates of the maximum value in the input, the index corresponds to the
first occurrence. For example, if the vector input is [.3 .2 .1 .2 .3]
,
the index of the maximum value is 1
, not 5
.
Value and Index
When Mode is set to Value and Index, the block outputs both the value, y, and the index, i.
In all three of the above modes, a matrix input, u
, is treated as a
vector, u(:)
.
Dialog Box
MOTDSP566 Minimum | Smallest component |