Given an absolutely continuous function $f(x)$ with $x\in[a,b]$ and $f(x)\geq 0$ (e.g. a signal pack), I am trying to deduct analytically another function $g(x)$ which counts (similar a step function) the relative minima (or relative maxima) of $f(x)$.
Can anybody help with such a minima counting function or references related to such a problem?
To emphasise and avoid any confusion, it is not only about finding the minima but counting them by an explicit function along $x\in[a,b]$.
Many thanks in advance.