DSP Blockset    
Maximum

Find the maximum values in an input or sequence of inputs.

Library

Statistics

Description

The Maximum block identifies the value and position of the largest element in each column of the input, or tracks the maximum values in a sequence of inputs over a period of time. The Mode parameter specifies the block's mode of operation and can be set to Value, Index, Value and Index, or Running.

Value Mode

When Mode is set to Value, the block computes the maximum value in each column of the M-by-N input matrix u independently at each sample time.

For convenience, length-M 1-D vector inputs and sample-based length-M row vector inputs are both treated as M-by-1 column vectors.

The output at each sample time, val, is a 1-by-N vector containing the maximum value of each column in u. For complex inputs, the block selects the value in each column that has the maximum magnitude, max(abs(u)), as shown below.

The frame status of the output is the same as that of the input.

Index Mode

When Mode is set to Index, the block computes the maximum value in each column of the M-by-N input matrix u,

and outputs the sample-based 1-by-N index vector, idx. Each value in idx is an integer in the range [1 M] indexing the maximum value in the corresponding column of u.

As in Value mode, length-M 1-D vector inputs and sample-based length-M row vector inputs are both treated as M-by-1 column vectors.

If a maximum value occurs more than once in a particular column of u, the computed index corresponds to the first occurrence. For example, if the input is the column vector [3 2 1 2 3]', the computed index of the maximum value is 1 rather than 5.

Value and Index Mode

When Mode is set to Value and Index, the block outputs both the vector of minima, val, and the vector of indices, idx.

Running Mode

When Mode is set to Running, the block tracks the maximum value of each channel in a time-sequence of M-by-N inputs. For sample-based inputs, the output is a sample-based M-by-N matrix with each element yij containing the maximum value observed in element uij for all inputs since the last reset. For frame-based inputs, the output is a frame-based M-by-N matrix with each element yij containing the maximum value observed in the jth column of all inputs since the last reset, up to and including element uij of the current input.

The block resets the running maximum whenever a reset event is detected at the optional Rst port. The reset event is specified by the Reset port menu, and can be one of the following:

For sample-based inputs, a reset event causes the running maximum for each channel to be initialized to the value in the corresponding channel of the current input. For frame-based inputs, a reset event causes the running maximum for each channel to be initialized to the earliest value in each channel of the current input. The Rst port can be disabled by selecting None from the Reset port menu.

As in the other modes, length-M 1-D vector inputs and sample-based length-M row vector inputs are both treated as M-by-1 column vectors.

Example

The Maximum block in the model below calculates the running maximum of a frame-based 3-by-2 (two-channel) matrix input, u. The running maximum is reset at t=2 by an impulse to the block's Rst port.

The Maximum block has the following settings:

The Signal From Workspace block has the following settings:

where

The Discrete Impulse block has the following settings:

The block's operation is shown in the figure below.

The statsdem demo illustrates the operation of several blocks from the Statistics library.

Dialog Box

Mode
The block's mode of operation: Output the maximum value of each input (Value), the index of the maximum value (Index), both the value and the index (Value and index), or track the maximum value of the input sequence over time (Running).
Reset port
Specifies the reset event detected at the Rst input port when Running is selected as the Mode parameter. The reset operation can be set to occur when a rising and/or falling edge is detected at the Rst port, (Rising edge, Falling edge, Either Edge), or when a non-zero sample is detected at the Rst port (Non-zero sample). The Rst port can be disabled by selecting None.

See Also

Mean
DSP Blockset
Minimum
DSP Blockset
MinMax
Simulink
max
MATLAB


 Matrix Viewer Mean