How to detect variations in data?

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.

 Respuesta aceptada

Image Analyst
Image Analyst el 24 de Dic. de 2019

1 voto

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

Más respuestas (1)

Ridwan Alam
Ridwan Alam el 23 de Dic. de 2019

1 voto

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 comentarios

Mohamed Nedal
Mohamed Nedal el 23 de Dic. de 2019
Can you show me an example plz?
It would make it much easier to understand.
Ridwan Alam
Ridwan Alam el 23 de Dic. de 2019
Please check the link above, there are some examples. Try on your own data, and if there is any difficulty, please feel free to ask about that.
Mohamed Nedal
Mohamed Nedal el 24 de Dic. de 2019
Editada: Mohamed Nedal el 24 de Dic. de 2019
Yes, it gives what I need for now. Thanks!
But I need to plot several findchangepts plots as subplots in a single figure. I found it can't be done unfortunately.
Do you know how to do that?
Ridwan Alam
Ridwan Alam el 24 de Dic. de 2019
Editada: Ridwan Alam el 24 de Dic. de 2019
Why can’t it be done? Please show your code and I will try to debug.
Here's what I was trying.
% define 3 column vectors
x1 = rand(30,1);
x2 = rand(30,1);
x3 = rand(30,1);
% first subplot
subplot(3,1,1)
findchangepts(x1,'MaxNumChanges',5);
% second subplot
subplot(3,1,2)
findchangepts(x2,'MaxNumChanges',5);
% third subplot
subplot(3,1,3)
findchangepts(x3,'MaxNumChanges',5);
Image Analyst
Image Analyst el 25 de Dic. de 2019
Did you also give my code a try?
Mohamed Nedal
Mohamed Nedal el 26 de Dic. de 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 el 26 de Dic. de 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.
Mohamed Nedal
Mohamed Nedal el 26 de Dic. de 2019
Okay, thanks a lot.

Iniciar sesión para comentar.

Productos

Versión

R2017b

Preguntada:

el 23 de Dic. de 2019

Comentada:

el 26 de Dic. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by