# How to find when a graph reaches a peak and plateaus?

This may sound very basic, but I have this problem: I've got a queue of data with a window size of 300. New data is added at one end, old values are removed from the other end.

I expect the queue data to stay more or less consistent, e.g.: 10,12,15,10,20, then start to rise sharply: 15,10,20,22,25,26,28,30,32... all the way up to 150 or so. There the data may fluctuate a bit, then it would go down with a similar slope (120,118,116,115...) all the way down to 20 or so.

I'm trying to identify the turning point in this data series programmatically, but my code detects peaks more often than I'd like to. How can I identify when the graph is rising, when it has reached a definitive turning point and when it starts to fall? Should I try to look at the rate of change of the rate of change?

-
If you have a reasonable sense of the slope andthe height of the peak, could you take account of both height and how long it's been climbing, as well as the current slope? How much prior data on peaks do you have, and could you use those to fit a model? – Karl Oct 18 '11 at 3:10
Whatever the method, you're going to have to properly define what is a peak and what is a plateau. Are two consecutive 'high' values a peak or a plateau? How about five? Some methods may not appear to need this information, but then this is hidden behind the scenes. As ever so often, it comes down to properly defining your problem, and the optimizing your parameters (and/or algorithm) for it. – Nick Sabbe Oct 18 '11 at 9:41