# localextrema: Finding Local Extrema and Zero-crossings of a Signal In EPT: Ensemble Patch Transform, Visualization and Decomposition

## Description

This function identifies local extrema and zero-crossings of a signal.

## Usage

 `1` ```localextrema(y) ```

## Arguments

 `y` a set of data or a signal.

## Details

This function identifies local extrema and zero-crossings of a signal.

## Value

 `minindex` matrix of time index at which local minima are attained. Each row specifies a starting and ending time index of a local minimum. `maxindex` matrix of time index at which local maxima are attained. Each row specifies a starting and ending time index of a local maximum. `nextreme` the number of extrema. `cross` matrix of time index of zero-crossings. Each row specifies a starting and ending time index of zero-crossings. `ncross` the number of zero-crossings.

`eptransf`, `eptdecomp`.

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10``` ```y <- c(0, 1, 2, 1, -1, 1:4, 5, 6, 0, -4, -6, -5:5, -2:2) #y <- c(0, 0, 0, 1, -1, 1:4, 4, 4, 0, 0, 0, -5:5, -2:2, 2, 2) #y <- c(0, 0, 0, 1, -1, 1:4, 4, 4, 0, 0, 0, -5:5, -2:2, 0, 0) plot(y, type = "b"); abline(h = 0) localextrema(y) findextrema <- localextrema(y) points(findextrema\$maxindex, y[findextrema\$maxindex], pch=16, col="red") points(findextrema\$minindex, y[findextrema\$minindex], pch=16, col="blue") ```

### Example output ```\$minindex
[,1] [,2]
[1,]    5    5
[2,]   14   14
[3,]   26   26

\$maxindex
[,1] [,2]
[1,]    3    3
[2,]   11   11
[3,]   25   25

\$nextreme
 6

\$cross
[,1] [,2]
[1,]    1    1
[2,]    4    5
[3,]    5    6
[4,]   12   12
[5,]   20   20
[6,]   25   26
[7,]   28   28

\$ncross
 7
```

EPT documentation built on Jan. 5, 2022, 9:06 a.m.