Identifying repeated patterns in data without knowing the pattern
17 views (last 30 days)
Show older comments
To analyze recorded signals of a car driving on a track, I need to identify and isolate the effective data range to perform further calculation. Below is what a typical speed signal may look like, with the x-axis being time. The data is simply stored in a ?x2 matrix with time being the first column. Since the car drives in circle, three repeated pattern can be identified visually, however, we didn't know what the pattern looked like. There are three types of unwanted signals to exclude:
- Continuous 0 or NaN at the beginning and the end (the periods between cycles are to be kept)
- The small hill before the first cycle. Sometimes it also happens at the end, but never between cycles.
- That false peak at the end caused by sensor gliches.
In the end, I only want to keep the blue line region for further processing. My current method is to first use rmoutliers to get rid of false peaks. Then to identify where the real cycles start, the code searches where the signal first reaches half of the maximum speed, and then locates the last time it went back to 0. The use of half the max speed is arbitrarily chosen, because the little hill (type 2) is usually less then that. However, sometimes it also causes a part of the pattern to be removed as well (yellow region), because it's smaller then 1/2 max speed and is followed by a 0 region. It would be most ideal, if a function can simply identify repeated pattern in a set of data, without knowing what the pattern looks like, so that I can simply extract that region. If not, any way to filter out those unwanted parts is appreciated as well.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1080645/image.png)
1 Comment
Image Analyst
on 28 Jul 2022
Is there something about the beginning and ending glitches that can identify where they are? That would probably be easier than to find out if some unknown/undefined pattern is replicated exactly or approximately some unknown number of times.
If you have any more questions, then attach your data and code to read it in with the paperclip icon after you read this:
Answers (1)
Mathias Smeets
on 28 Jul 2022
This will detect which values are returning often in your code, this way you might be able to detect some values that are not used often and therefor can be thrown away.
See Also
Categories
Find more on Spectral Measurements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!