Learn R Programming

synchrony (version 0.3.8)

find.minmax: Find min/max of a time series

Description

Find local minima and maxima of a time series

Usage

find.minmax (timeseries)

Arguments

timeseries

time series in matrix format (n rows x 2 columns). The first column should contain the time steps and the second column should contain the values. If timeseries is a column vector instead of a matrix, then it will be automatically converted to a matrix with column 1 corresponding to a time index ranging from 1 to the length of timeseries

Value

Returns a named list containing:

mins

n x 3 matrix containing the index, time steps, and the local min values

maxs

n x 3 matrix containing the index, time steps, and the local max values

Examples

Run this code
# NOT RUN {
t1=runif(100)
min.max=find.minmax(t1)
min.max$maxs
plot (t1, t="l")
points (min.max$mins, col="blue", bg="blue", pch=19)
points (min.max$maxs, col="red", bg="red", pch=19)
# }

Run the code above in your browser using DataLab