Maximum
The maximum values of the input data or sequence of input data.
Description
The Maximum block determines the value and position of the largest element in each row or column of the input data, or along vectors of a given input data size. It can also calculate the maximum value of the entire input signal.
The Mode parameter determines the mode of the block and can be set to one of the following values:
-
Value
- the block outputs the maximum values in the specified dimension. -
Index
- the block outputs an array of indices with maximum values in the specified dimension. -
Value and Index
- the block outputs the maximum values and the corresponding index array in the specified dimension.
You can specify the dimension using the Find the maximum value over parameter.
Ports
Input
In - data input
vector
| matrix
The block accepts multichannel and multidimensional input data with real or complex value. Input data can be floating point or logical.
Data types: Float16
, Float32
, Float64
, Int8
, Int16
, Int32
, Int64
, Int128
, UInt8
, UInt16
, UInt32
, UInt64
, UInt128
.
Support for complex numbers: Yes
Output
Val - maximum values for the specified dimension
scalar
| vector
| matrix
The data type of the maximum value corresponds to the input data type.
If Mode is set to either Value and Index
or Value
, the following applies:
-
The dimension of the dimension for which the block calculates the maximum value is
1
. The dimensions of all other dimensions are the same as the dimensions of the input array. For example, when the input is an array M by N by P with dimension set to1
, the block outputs an array of 1 by N by P. When the dimension is set to3
, the block outputs a two-dimensional matrix M by N. -
When the input signal is an M by N matrix with the dimension set to
1
, the block outputs a 1 by N matrix.
If you specify the block to calculate the maximum value over all input data, the block outputs a scalar.
Data types: Float64
.
Idx - index of maximum values along the specified dimension
scalar
| vector
| matrix
When the input data is double, the index values are also doubled.
Dependencies
To use this port, set the Mode parameter to either Value and Index
or Value
.
Data types: Float64
.
Parameters
Main
Mode - mode in which the block works
Value and Index (by default)
| Value
| Index
When the Mode parameter is set to:
-
Value
- the block calculates the maximum value in each row or column of the input data or along vectors of a given input data size. It can also compute the maximum value of all input data at each sampling point and outputs an array . Each element in the output is the maximum value in the corresponding column, row, vector, or in all input data. The output of depends on the setting of Find the maximum value over. Consider a three-dimensional input of size M by N on P. Find the maximum value over is set to:-
Each row
- the output data at each sampling time consists of an M by 1 array on P, where each element contains the maximum value of each vector along the second dimension of the input data. For an M by N matrix input data, the output data at each sampling time is the M by 1 column vector. -
Each column
- the output data at each sampling time consists of an array of size 1 by N by P, where each element contains the maximum value of each vector along the first dimension of the input data. For an input matrix of size M by N, the output at each sampling instant is a vector of rows of size 1 by N.In this mode, the block processes the input data of undirected vectors of length as vectors of columns of size M by 1.
-
Entire input
- the output at each sampling moment is a scalar that contains the maximum value in the input matrix M by N by P. -
Specified dimension
- the output of at each sampling time is dimension dependent. If the dimension is set to1
, the output will be the same as when each column is selected. If the dimension is set to2
, the output will be the same as when each row is selected. If the dimension is set to3
, the output data at each sampling time is an M by N matrix containing the maximum value of each vector along the third dimension of the input data.
-
*Complex input data.
For complex input data, the block selects the value in each row or column of the input data along vectors of a given dimension of the input data or the entire input signal that has the maximum value squared, as shown in the following figure. For the complex value the squared value is .
-
Index
- the block calculates the maximum value in each row or column of the input data along vectors of a given input size or the whole input and outputs an array of indices . Each element in is an integer indexing the maximum value in the corresponding column, row, vector, or entire input. The result of depends on the setting of the Find the maximum value over parameter. Consider a three-dimensional input signal of size M by N by P:-
Each row
- the output of at each sampling time consists of an M by 1 array on P, where each element contains the index of the maximum value of each vector along the second dimension of the input data. For the input data, which is an M by N matrix, the output at each sampling time is an M by 1 column vector. -
Each column
- the output of at each sampling time consists of a 1 by N by P array, where each element contains the index of the maximum value of each vector along the first dimension of the input data. For the input data, which is an M by N matrix, the output at each sampling time is a 1 by N vector of rows.In this mode, the block processes the input data of undirected vectors of length as M by 1 column vectors.
-
Entire input
- the output of at each sampling time represents a vector of size 1 by 3 that contains the location of the maximum value in the input matrix M by N by P. For input data that is an M by N matrix, the output data is a 1 by 2 vector. -
Specified dimension
- The output of at each sampling point is dimension dependent. If the dimension is set to1
, the output is the same as when each column is selected. If the dimension is set to2
, the output will be the same as when each row is selected. If the dimension is set to3
, the output data at each sampling time is an M by N matrix containing the indices of the maximum values of each vector along the third dimension of the input data.
-
When the maximum value occurs more than once, the computed index corresponds to the first occurrence. For example, when the input data is the column vector [3 2 1 2 2 3]'
, the computed index of the maximum value on a unit basis is 1
rather than 5
when Each column
is selected.
-
Value and Index
- the unit outputs the maximum value in each row or column of the input data along vectors of a given input data dimension or the entire input and the corresponding index array .
Find the maximum value over - the dimension by which the block calculates the maximum value
Each column (by default)
| Each row
| Entire input
| Specified dimension
Each column
- the block outputs the maximum value for each column.
Each row
- block outputs the maximum value for each row.
Entire input
- block outputs the maximum value for the whole input.
Specified dimension
- block outputs the maximum value compared to the size specified in the Dimension parameter.
Dependencies
To use this parameter, set Mode to Index
, to Value
, or to Value and Index
.
Dimension - custom dimensionality
1 (By default)
| scalar
.
Specify the dimension (unit-based value) of the input signal from which the block calculates the maximum. The value of this parameter must be greater than zero and less than the number of dimensions in the input signal.
Dependencies
To use this parameter, set Find the maximum value over to Specified dimension
.