How to find the maxima and minima of discontinous function? I have some data and it looks like Sawtooth wave and I have to find out the distance between two consecutive peaks and for this purpose, I am trying to calculate derivative and then finding out distance between two minimas. Please suggest, what should be the appropriate way to calculate the distance between consecutive peaks.

For a discontinuous function $ f(a)=>f(a+h) & f(a)=>f(a-h) $ ,then f(x) has maxima at x=a. 
$ f(a)<=f(a+h) & f(a)<=f(a-h)$  ,then f(x) has minima at x=a .
Where h is a very small value and a is constant.
These are condition for maxima and minima in a discontinous function graph.                                                                                                                                                                                                                                                                                           
