NextExtremum (FPScript)

21.09.2021

Searches for the next extreme from a given position onwards.

Syntax

NextExtremum(DataSet, [ Position ], Hysteresis, [ Orientation = EVENT_BOTH ] [ , Direction = EVENT_RIGHT ])

 

The syntax of the NextExtremum function consists of the following parts:

Part

Description

DataSet

The data set to be searched.

Permitted data structures are data series und signal. All numeric data types are permitted.

For complex data types the absolute value is formed.

If the argument is a list, then the function is executed for each element of the list and the result is also a list.

Position

If you are searching in a signal, this is the X value where the search is to start. If you are searching a data series, this is the index of the value where the search is to start. Here, a negative index determines a position relative to the end of the data set. If you omit the argument or pass the value Empty, the search starts at the beginning or end of the data set, depending on the direction of the search. The first or last value of the data set is only taken into account if you omit the argument or pass the Empty value.

Permitted data structures are scalar value. All numeric data types are permitted. The unit has to be compatible with that of parameter DataSet.

For complex data types the absolute value is formed.

If the argument is a list, then the function is executed for each element of the list and the result is also a list.

Hysteresis

Specifies the minimum amount by which the signal must rise or fall after the extremum in order for the extremum to be accepted.

Permitted data structures are scalar value. All numeric data types are permitted. The unit has to be compatible with that of parameter DataSet.

For complex data types the absolute value is formed.

If the argument is a list, then the function is executed for each element of the list and the result is also a list.

Orientation

Specifies whether minima, maxima or both are to be searched for.

The argument Orientation can have the following values:

Constant

Meaning

EVENT_POSITIVE

Search for local maximum only.

EVENT_NEGATIVE

Search for local minimum only.

EVENT_BOTH

Search for local minimum and maximum.

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

If this argument is omitted, it will be set to the default value EVENT_BOTH.

Direction

Specifies the direction of the search in the function.

The argument Direction can have the following values:

Constant

Meaning

EVENT_RIGHT

Search to the right.

EVENT_LEFT

Search to the left.

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

If this argument is omitted, it will be set to the default value EVENT_RIGHT.

Remarks

The result always has the data structure scalar value.

The local extremum in the data set is identified using a hysteresis. A value is recognized as a local maximum when the previous values in the data set increase by at least the specified hysteresis amount, and the subsequent values decrease by at least the specified hysteresis amount. A value is recognized as a local minimum when the previous values in the data set decrease by at least the specified hysteresis amount, and the subsequent values increase by at least the specified hysteresis amount.

If DataSet is a data series, the result is the index of the extremum found. If DataSet is a signal, the result is the X value of the extremum. If no extremum could be found, the value Empty is output as the result.

Available in

FlexPro Basic, Professional, Developer Suite

Examples

NextExtremum(Signal, , 0.1 V, EVENT_POSITIVE, EVENT_LEFT)

Searches in a signal from the end of the signal heading left for the next local maximum. The hysteresis is 0.1 V. The result is the X value of the extremum found.

Signal[[NextExtremum(Signal, 4.5 s, 0.1 V)]]

Searches in a signal for the next local minimum or maximum, starting at the position X = 4.5 s and heading to the right. The hysteresis is 0.1 V. The result is the Y value of the extremum found.

See Also

Extrema Function

Event Isolation Analysis Object

Share article or send as email:

You might be interested in these articles