   Finding "plateaus" in data points
  Hello all, I''ve taken on a fairly simple programming job in data analysis and need a bit of help on a task. I have over a thousand data points that describe a graph of this shape:   /\  /  \   ___ /    \_/   \/  \As you can see, it has 2 peaks; I''m interested in the 2nd, specifically, identifying where the plateau starts and ends. The illustration above is macro-view, the real graph is pretty rough.Does anyone have any ideas toward an algorithm that I could use to identify the start and end points of the 2nd peak? I''m currently thinking about some sort of running average. 
  I'm thinking of a "running error" If some tolerance of "plateauness" (ie. being in the same level -ness) is not crossed between subsequent amount of n   points, then I'd consider the points which passed the test as a plateau.-Nik   [edited by - Nik02 on February 10, 2004 2:46:47 PM];  The trick is to find the derivative of the function. It''s okay if it''s just the deltas between the data points.Then, look for long areas of almost-zero. Those are your plateaus.This is pretty much the same thing as Nik''s saying, just phrased differently.   "Sneftel is correct, if rather vulgar." --Flarelocke ;quote:Original post by Sneftel  The trick is to find the derivative of the function. It''s okay if it''s just the deltas between the data points.Then, look for long areas of almost-zero. Those are your plateaus.This is pretty much the same thing as Nik''s saying, just phrased differently.   "Sneftel is correct, if rather vulgar." --Flarelocke   I was looking for the word "delta", I''m not very good with English math terms -Nik ;  Problem is, this isn''t a straight-up mathematical function: it''s output data from a torque measurement machine. ;  Yes, but you don't need to do anything else except to compare differences between some number of adjacent data points.Noise is a function too - not necessarily rational or continuous one - but that doesn't matter here!-Nik    [edited by - Nik02 on February 11, 2004 10:22:50 AM];quote:Original post by Nik02  I was looking for the word "delta", I''m not very good with English math terms -Nik   It''s not and English maths term .Δt ring a bell? "Finishing in second place, simply means you are the first loser." - PouyaCat;quote:Original post by JNewt/\  /  \   ___ /    \_/   \/  \  As you can see, it has 2 peaks; I''m interested in the 2nd, specifically, identifying where the plateau starts and ends. The illustration above is macro-view, the real graph is pretty rough.You might run a low-pass filter on the data to smooth it out a bit so that it more closely resembles the above. Then, as mentioned before, check the gradients and the derivatives.You might also look into Sobel and Laplacian operators as they are designed for this sort of thing (finding changes of gradient over discrete data). What you''re doing is basically what an image processing package would call edge-detection. I believe the Sobel operators detect any non-zero gradient whereas the Laplacian one detects a change in gradient.   [ MSVC Fixes | STL Docs | SDL | Game AI | Sockets | C++ Faq Lite | Boost  Asking Questions | Organising code files | My stuff | Tiny XML | STLPort]    ;quote:Original post by Crispy  quote:Original post by Nik02   I was looking for the word "delta", I''m not very good with English math terms -Nik   It''s not and English maths term .Δt ring a bell? In Finland, they teach the concept as "siirtymä" - not quite same sounding as "delta", is it? But yes, I know the concept very well kind rgds,Nik ;quote:Original post by Nik02  In Finland, they teach the concept as "siirtymä" - not quite same sounding as "delta", is it? But yes, I know the concept very well Well, you Finns are weird (in a good way ) - here in Estonia we just use the Greek alphabet and everything works just fine - no ambiguity, portable language-wise and it even sounds cool. "Finishing in second place, simply means you are the first loser." - PouyaCat