Documentation

# dsp.Maximum

(To be removed) Find maximum value of input or sequence of inputs

## Description

The `dsp.Maximum` object finds the maximum values of an input or sequence of inputs.

### Note

The `dsp.Maximum` System object™ will be removed in a future release. To compute the maximum, use the `max` function. To compute the running maximum in MATLAB®, use the `dsp.MovingMaximum` object. For more information, see Compatibility Considerations.

To compute the maximum value of an input or sequence of inputs:

1. Create the `dsp.Maximum` object and set its properties.

2. Call the object with arguments, as if it were a function.

## Creation

### Syntax

``max = dsp.Maximum``
``max = dsp.Maximum(Name,Value)``

### Description

````max = dsp.Maximum` returns an object, `max`, that computes the value and index of the maximum elements in an input or a sequence of inputs along the specified Dimension.```
````max = dsp.Maximum(Name,Value)` returns a maximum-finding object, `max`, with each specified property set to the specified value.```

## Properties

expand all

Unless otherwise indicated, properties are nontunable, which means you cannot change their values after calling the object. Objects lock when you call them, and the `release` function unlocks them.

If a property is tunable, you can change its value at any time.

Set this property to `true` in order to output the maximum of the input.

#### Dependencies

This property applies only when you set the `RunningMaximum` property to false.

When you set this property to `true`, the object computes the maximum value over successive calls to the object algorithm. When you set this property to `false`, the object computes the maximum value over the current input.

Set this property to `true` to output the index of the maximum value of the input.

#### Dependencies

This property applies only when you set the `RunningMaximum` property to `false`.

Set this property to `true` to enable resetting the running maximum. When you set this property to `true`, you must specify a reset input to the object algorithm to reset the running maximum.

#### Dependencies

This property applies only when you set the `RunningMaximum` property to `true`.

Specify the event that resets the running maximum.

#### Dependencies

This property applies only when you set the ResetInputPort property to `true`.

Specify whether to start the index numbering from `One` or `Zero` when computing the index of the maximum value.

#### Dependencies

This property applies only when you set the `IndexOutputPort` property to `true`.

Specify how the maximum calculation is performed over the data.

#### Dependencies

This property applies when you set the `RunningMaximum` property to `false`.

Specify the integer dimension of the input signal over which the object finds the maximum. The custom dimension cannot exceed the number of dimensions in the input signal.

#### Dependencies

This property only applies when you set the Dimension property to `Custom`.

Data Types: `single` | `double` | `int8` | `int16` | `int32` | `int64` | `uint8` | `uint16` | `uint32` | `uint64`

### Fixed-Point Properties

Specify the rounding method.

Specify the overflow action.

Specify the product fixed-point data type.

Specify the product fixed-point type as a scaled `numerictype` object with a `Signedness` of `Auto`.

#### Dependencies

This property applies only when you set the `ProductDataType` property to `Custom`.

Specify the accumulator fixed-point data type.

Specify the accumulator fixed-point type as a scaled `numerictype` object with a `Signedness` of `Auto`.

#### Dependencies

This property applies only when you set the `AccumulatorDataType` property to `Custom`.

## Usage

### Syntax

``[val,ind] = max(x)``
``val = max(x)``
``ind = max(x)``
``val = max(x,r)``

### Description

````[val,ind] = max(x)` returns the maximum value, `val`, and the index or position of the maximum value, `ind`, along the specified `Dimension` of `x`.```
````val = max(x)` returns the maximum value, `val`, of the input `x`. When the `RunningMaximum` property is `true`, `val` corresponds to the maximum value over successive calls to the object algorithm.```
````ind = max(x)` returns the zero- or one-based index `ind` of the maximum value. To enable this type of processing, set the `IndexOutputPort` property to `true` and the `ValueOutputPort` and `RunningMaximum` properties to `false`.```
````val = max(x,r)` resets the state of `max` based on the value of reset signal, `r`, and the `ResetCondition` property. To enable this type of processing, set the `RunningMaximum` property to `true` and the `ResetInputPort` property to `true`.```

### Input Arguments

expand all

Data input, specified as a vector or a matrix. If `x` is a matrix, each column is treated as an independent channel. The maximum is determined along each channel. The object also accepts variable-size inputs. Once the object is locked, you can change the size of each input channel.

Data Types: `single` | `double` | `int8` | `int16` | `int32` | `int64` | `uint8` | `uint16` | `uint32` | `uint64` | `fi`
Complex Number Support: Yes

Reset signal used to reset the running maximum, specified as a scalar value. The object resets the running maximum if the reset signal satisfies the `ResetCondition`.

#### Dependencies

To enable this signal, set the `RunningMaximum` property to `true` and the `ResetInputPort` property to `true`.

Data Types: `single` | `double` | `int8` | `int16` | `int32` | `uint8` | `uint16` | `uint32` | `logical`

### Output Arguments

expand all

Maximum value of the input, returned as a scalar or a vector. The object determines the maximum value of the input along each channel. If the input is a column vector, the output is a scalar. If the input is a multichannel signal, the output signal is a 1-by-N vector, where N is the number of input channels.

Data Types: `single` | `double` | `int8` | `int16` | `int32` | `int64` | `uint8` | `uint16` | `uint32` | `uint64` | `fi`
Complex Number Support: Yes

Indices of the maximum values of the input, returned as a scalar or a vector. The object determines the indices of the maximum values of the input along each channel. If the input is a column vector, the output is a scalar. If the input is a multichannel signal, the output signal is a 1-by-N vector, where N is the number of input channels.

Data Types: `double` | `uint32`

## Object Functions

To use an object function, specify the System object as the first input argument. For example, to release system resources of a System object named `obj`, use this syntax:

`release(obj)`

expand all

 `step` Run System object algorithm `release` Release resources and allow changes to System object property values and input characteristics `reset` Reset internal states of System object

## Examples

### Compute Maximum and Running Maximum of Signal

Note: If you are using R2016a or an earlier release, replace each call to the object with the equivalent `step` syntax. For example, `obj(x)` becomes `step(obj,x)`.

Find a maximum value and its index.

```max1 = dsp.Maximum; x = randn(100,1); [y,I] = max1(x)```
```y = 3.5784 ```
```I = 9 ```

Compute a running maximum.

``` max2 = dsp.Maximum; max2.RunningMaximum = true; x = randn(100,1); z = max2(x); plot(z)``` z(i) is the maximum of all values in the vector x(1:i).

## Algorithms

This object implements the algorithm, inputs, and outputs described on the Maximum block reference page. The object properties correspond to the block parameters.

## Compatibility Considerations

expand all

Warns starting in R2019b

Watch now