MATLAB: How to detect start points and end points of plateaus in graph plotted from a data set

graphsplateaus

I have large set of data for x and y axis. I have plotted the graphs on matlab and I want to detect the begining and ending of the plateaus in the graph where the slope is decreasing significantly for a period of time. The problem is the graph is very uneven throughout and if I apply a threshold for slopes, the uneven points also get detected. Is there a way by which i can detect a regions with very less variation of data in comparison to the whole graph. If you give a solution in details,I will be very grateful.
nanoindent graph.JPG

Best Answer

There are some uncertainties in your problem:
  1. How noisy is the data? Is there variation of intensity within the plateau?
  2. Do you know the expected length of the plateau?
For 1 you could remove the noise by applying a filter, a small low pass filter would remove noise, but at the same time could modify the edges of the plateau. Thus a median filter could provide you with better results.
For 2, if you do know the length, you could use a moving filter checking for the variation within a range of values, if the standard deviation of, say 10,20,30 elements is below a certain value, then you know that you are in the plateau.