1
$\begingroup$

The following code lets FindPeaks find minima in v10.3-12.0:

dat = TimeSeries[{{1, 1}, {2, 2}, {3, 1}, {4, 2}}];
Normal[-FindPeaks[-dat]]
(* {{1, 1}, {3, 1}} *)

but fails in v10.0:

(* FindPeaks::arg -- Message text not found -- *)

What's the problem and how to work around it?

$\endgroup$
1
$\begingroup$

Evidently the ability to do arithmetic on TimeSeries was added some time after v10.0 (maybe v10.1 based on the docs). There is a new section in the v10.3 docs for TimeSeries > Examples > Scope > Time Series Arithmetic that says "Numerical, listable functions automatically thread over values of time series".

A workaround:

Normal[TimeSeriesMap[Minus, FindPeaks[TimeSeriesMap[Minus, dat]]]]
(* {{1, 1}, {3, 1}} *)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.