NextPositivePeak (FPScript)

21.09.2021

Searches in a data set for the next positive peak starting from a predefined position.

Syntax

NextPositivePeak(DataSet, [ Position ], Level, [ Orientation = EVENT_BOTH ], [ Direction = EVENT_RIGHT ], [ DeltaXmin ] [ , DeltaXmax ])

 

The syntax of the NextPositivePeak 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 the X component additional restrictions do apply.The values must be monotonously increasing.

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.

Level

Specifies the level above which the values must lie. Only peaks are found that have level crossings in both directions. A peak beginning is found when the value is greater than or equal to the level and the previous value is less than the level. A peak end is found when the value is greater than or equal to the level and the subsequent value is less than the level.

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 the orientation of the peaks to be found.

The argument Orientation can have the following values:

Constant

Meaning

EVENT_BEGINNING

Search only for beginnings of peaks.

EVENT_END

Search only for ends of peaks.

EVENT_BOTH

Search for peak beginnings and ends.

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.

DeltaXmin

Optionally determines the minimum duration or number of values that an event must endure to be valid. If you search within a signal, this equals the X range from the first value of the event to the last value of the event. If you search within a data series, this is the minimum number of data points that the event must have.

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 first element in the list is taken. If this is also a list, then the process is repeated.

DeltaXmax

Optionally determines the maximum duration or number of values that an event can endure to be valid. If you search within a signal, this equals the X range from the first value of the event to the last value of the event. If you search within a data series, this is the maximum number of data points that the event can have.

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 first element in the list is taken. If this is also a list, then the process is repeated.

Remarks

The result always has the data structure scalar value.

If DataSet is a data series, the result is the index of the peak beginning or end found. If DataSet is a signal, then the result is the X value of the peak beginning or end. If no peak could be found, the value Empty is output as the result.

Available in

FlexPro Basic, Professional, Developer Suite

Examples

NextPositivePeak(Signal({3,1,1,3,2,1,4,3,2,1,4,1},1), , 2, EVENT_BOTH, EVENT_RIGHT, 2)

Results in 6. Searches in the data set from the beginning for the next positive peak with a minimum width of 2, for which the level crossing is at 2. The X value where the peak begins is returned.

NextPositivePeak({2,4,4,3,2,1,4,3,2,1,4,1}, , 2, EVENT_BOTH, EVENT_RIGHT, , 2)

Results in 10L. Searches in the data set from the beginning for the next positive peak with a maximum of 2 values whose level crossing is at 2. The index where the peak begins is returned.

NextPositivePeak({2,4,4,3,2,1,4,3,2,1,3,4,1}, -1, 2, EVENT_POSITIVE, EVENT_LEFT)

Results in 10L. Searches in reverse starting from the end of the data set for the next positive peak whose level crossing is at 2. The index where the peak begins is returned.

See Also

PositivePeaks Function

NegativePeaks Function

NextNegativePeak Function

LevelCrossings Function

ValuesAboveLevel Function

ValuesBelowLevel Function

ValuesInInterval Function

Event Isolation Analysis Object

Share article or send as email:

You might be interested in these articles