05-09-2018 02:51 AM
Hi,
can anyone help me detect the plateaus in this signal (beginning and end locations)?
Solved! Go to Solution.
05-09-2018 03:04 AM
05-09-2018 03:15 AM
Hi GerdW,
I'm not sure if the naming is correct. Please see the figure.
Thanks
05-09-2018 03:21 AM - edited 05-09-2018 03:28 AM
Hi Sarah,
so you want to find subsets in your array where consecutive elements have the same value?
Use a loop and compare current element with previous one: if they are the same you have found a "plateau"…
Result of this very simplistic approach:
Plateaus marked with red plot…
05-09-2018 07:47 AM
Hi GerdW,
thanks for ur reply.
No, the subsets don't contain same values (check the circles in the figure in my last post). The values in each step (plateau) are also containing noise. They are below or under a mean value. I have an overall standard deviation for these values, so i can define a % of variation between the values at each step.
So I want to detect this kind of steps, and measure its length.
I also have the problem that the signal is rising. So I cannot define a threshold, like for a normal squared signal. If it is so, then I can detect and measure the length of the each "step" array using two loops.
I hope I could explain my problem.
05-09-2018 07:57 AM
Hi Sarah,
The values in each step (plateau) are also containing noise. They are below or under a mean value. I have an overall standard deviation for these values, so i can define a % of variation between the values at each step.
Then you don't need to compare for being equal, but you need to check for being within a certain range… (When it comes to ranges you should immediatly think InRangeAndCoerce!)
I also have the problem that the signal is rising.
You might remove this "rising" by subtracting a variable offset…
Determine the rise rate (aka gradient) from your data and use it to level out the curve!
05-09-2018 08:21 AM
One other way to look for the plateaus would be a slope change. It looks like most of the plateaus are flat so you could look for a slope value within a certain range or below some set point.
05-09-2018 09:53 AM
Something like this. I ran the data and it seemed to find all of the plateaus and the lengths.
05-10-2018 07:28 PM
You can do this in a way that doesn't require looking at each sample using a FOR loop, which will probably be faster if you have a lot of data.
By applying a criteria to the point-to-point slope data to turn it into a Boolean array you can use "search 1D array" to find the indexes where the answer to "is plateau?" question changes. The indexes are related to the timestamp by the sample rate so you turn indexes into time by simple multiplication.
05-14-2018 03:39 AM - edited 05-14-2018 03:47 AM
Thanks to Tim, Zwired1 and GerdW
@ GerdW: subtracting a variable offset won't work for each signal that I have. In some cases it may sink and then rise because of any interference or other disturbances. Defining this would be too complicated (for me) for this purpose I think. So the slope can be used for this purpose, plus using InRange and Coerce (thanks for the hint)
@Zwired:
I tried ur code, but I needed to define more criterias so that it works properly. Thank you that u shared the screenshot.
@Tim
ur code works best for my present data that I become at the moment. Thank you very much for posting the code!!