MATLAB Answers

How to detect variations in data?

7 views (last 30 days)
Hello everyone,
I would like to determine the location at which there is data variation (like the highlighted points in the attached image).
Kindly find the attached code + .mat file.
Each sub-plot represents a variable on y-axis and the time on x-axis. Usually, the variation appear in several variables (plots) like this one.
data .jpg
Could you suggest the best method to do so?
and How can I determine the starting and ending points of that variation?
I appreciate your help.

  0 Comments

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 24 Dec 2019
You might try movstd() to do a sliding window standard deviation. Then threshold it to find elements where the standard deviation is what you deem "high". See attached code where I did it for your "B" signal. Adapt it to do any other signals you want.
0000 Screenshot.png

  1 Comment

Sign in to comment.

More Answers (1)

Ridwan Alam
Ridwan Alam on 23 Dec 2019
Depends on how complex of a solution you are looking for. There are algorithms for change point detection that you can try.
Or, you can have a sliding window (your defined size) over the signal and look for specific features (e.g mean crossing rate, variance, etc. depending your signal type) to find the windows that contain a "change".
Hope this helps.

  9 Comments

Show 6 older comments
Mohamed Nedal
Mohamed Nedal on 26 Dec 2019
Yes, I tried it and it works. Thanks!
But it doesn't depend on findchangepts function, which is fine, I just would like to compare your code's result with that of findchangepts results.
Image Analyst
Image Analyst on 26 Dec 2019
I think findchangepts() locates points where the data goes from smooth to something drastically different, or vice versa. So it basically finds corners or elbows in the data.
movstd() on the other hand gives a high signal wherever the data has high variability regardless if the signal looks like a corner or elbow there.

Sign in to comment.

Sign in to answer this question.