how to search start and end indices of longer interval with threshold and variance conditions

1 次查看(过去 30 天)
Hi all,
I am searching a solution for my aim but I still not found it. I would like to find the longer interval where there are mostly bigger changes on values. I tried differnet solution as findpeaks and some sperimental method but no one helped me. I found the function https://it.mathworks.com/help/signal/ref/findchangepts.html and it is interesting but gives me not indices as output. My aim is to take the interval with the loger red line in this pic.
The below plots are my examples. I hope you don't care about the care of the the images.

回答(1 个)

dpb
dpb 2022-5-21
The function does return the change point indices -- you just didn't call it with a return value to save them...that plot looks like the function does a really nice job--I wasn't aware of it.
>> help findchangepts
findchangepts finds abrupt changes in a signal
IPOINT = findchangepts(X) returns the index in X that corresponds to the most significant change in mean.
...
So, write your above as
iPts=findchangepts(t,'MaxNumChanges',5);
instead.
PS.
't' is a peculiar variable name to choose for the waveform, that would more normally be associated with the time vector. Clearly it is your data here, and what you choose is your call, but would seem more appropriate to use something more representative of what your data content is.

Community Treasure Hunt

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

Start Hunting!

Translated by