extrema: Finding Local Extrema and Zero-crossings

Description Usage Arguments Details Value See Also Examples

View source: R/EMD1d.R

Description

This function indentifies extrema and zero-crossings.

Usage

1
extrema(y, ndata = length(y), ndatam1 = ndata - 1)

Arguments

y

input signal

ndata

the number of observation

ndatam1

the number of observation - 1

Details

This function indentifies extrema and zero-crossings.

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

See Also

extrema2dC, extractimf, emd.

Examples

1
2
3
4
5
6
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)
extrema(y)

Example output

Loading required package: fields
Loading required package: spam
Loading required package: dotCall64
Loading required package: grid
Spam version 2.1-1 (2017-07-02) is loaded.
Type 'help( Spam)' or 'demo( spam)' for a short introduction 
and overview of this package.
Help for individual functions is also obtained by adding the
suffix '.spam' to the function name, e.g. 'help( chol.spam)'.

Attaching package: 'spam'

The following objects are masked from 'package:base':

    backsolve, forwardsolve

Loading required package: maps
Loading required package: locfit
locfit 1.5-9.1 	 2013-03-22
$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
[1] 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
[1] 7

EMD documentation built on Jan. 4, 2022, 1:08 a.m.

Related to extrema in EMD...