MATLAB Answers

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

131 views (last 30 days)
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


Adam on 3 Dec 2019
You could try creating a smooth curve (you'd have to try out different smoothing - I often tend to favour Savitsky-golay - doc sgolayfilt) and look at the difference between the smoothed curve and the actual one. You can then find points where they differ significantly, which would include such flat areas (depending on the smoothing used).
Alternatively just using diff or graidient should still highlight regions like that as being a lot lower than the surrounding areas.
Atul Anand
Atul Anand on 3 Dec 2019
Will smoothing the curve just remove the noise? or also the plateau in the output? because the if it doesn't remove the plateau and just the noise, then comparing won't help detect the plateaus.
Adam on 3 Dec 2019
That's why I said you'd have to play around with the type of smoothing. Some smoothing would just put a clean curve round that data shown, completely smoothing over the plateau, other smoothing would try to follow the plateau if it is too local. Smoothing is never an exact science, it's almost always trial and error.

Sign in to comment.

Accepted Answer

Constantino Carlos Reyes-Aldasoro
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.

  1 Comment

Atul Anand
Atul Anand on 3 Dec 2019
  1. The noise is high enough to be confused with start of plateau. Yes. there is variation in intensity in the plateau as well. But i guess a small variation from actual start can be ok.
  2. The threshold for width of plateau is 1.2 on x axis. A plateau with more than wdith of 1.2 nm is supposed to be detected.
  3. How do I use a moving filter? Are you suggesting to use either low pass or medain or moving filter? any one of them? or are you suggesting to smooth the curve first with a low pass or median filter and then use a moving filter to detect the plateau?

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by