How to identify the start and stop in a series of data

4 次查看(过去 30 天)
Hello, I am trying to determine the beginning and the end of a full movement. So I have as sensor, that I used to collect data for specific movement. If i were to plot it out, I can see 3 mountains/peaks, with a relatively stable segment in between each mountain. I would like to identify the start and stop of each mountain. How do I do so? Any algorithm to find the start and end of a movement?

回答(1 个)

Manish Mahalwal
Manish Mahalwal 2021-1-18
Hi,
This solution may vary according to the type of data you have but by what you described this should work.
You can find the local maximas using findpeaks.
[pks,locs] = findpeaks(data)
'locs' contains the location of the local maximas that is the x-coordinate. Now you will have to use these peaks to find the local minimas which surround these peaks. For this, you can use islocalmin to find the points of local minima.
TF = islocalmin(A)
This returns a logical array whose elements are 1 (true) when a local minimum is detected in the corresponding element of an array, table, or timetable.
Now you iterate over 'locs' to find the value immediately smaller and greater using TF and A (the two local minimas surrounding the peak). The two values that you get would be the start and end of the corresponding peak.
Hope this helps.
  1 个评论
Eva DI NOIA
Eva DI NOIA 2022-6-28
Hello,
Can you explain your method to me? I don't know how to use "islocalmin" is for finding the minima that surround these peaks. What is "A"?
Thank you for your help

请先登录,再进行评论。

标签

Community Treasure Hunt

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

Start Hunting!

Translated by