Find local minima and maxima of a time series
find.minmax (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
Returns a named list containing:
n
x 3 matrix containing the index, time steps, and the local min values
n
x 3 matrix containing the index, time steps, and the local max values
# 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