Skip to contents

Returns sample indices (1-based) where x crosses threshold in the chosen direction. min_distance enforces a minimum gap (in samples) between successive events.

Usage

morie_dsp_threshold_detect(
  x,
  threshold,
  min_distance = 1L,
  direction = "above"
)

Arguments

x

Numeric vector.

threshold

Scalar threshold.

min_distance

Minimum gap between events. Default 1.

direction

One of "above", "below", "either". Default "above".

Value

Integer vector of detected indices.

References

Rangayyan & Krishnan (2015), Ch. 4, sec. 4.2.