Filter löschen
Filter löschen

How to recognize repetition in data for a certain period of time?

2 Ansichten (letzte 30 Tage)
Jacqueline
Jacqueline am 3 Jul. 2013
Hi, first off I am very new to Matlab. I asked a similar question yesterday but I don't think I was specific enough so I'm going to try again...
I am analyzing data that comes from a truck, such as engine speed, vehicle speed, etc. The data is collected randomly throughout the day for about 3 hours (10,000 seconds). I am trying to write a script that will detect any repetition in the data that last for 60 seconds or more. Because if that happens, there is something wrong with the sensors in the truck.
For example, if for engine speed I had 10,000 points ranging from 0-2100, and for 60 seconds in a row the data was stuck on 1,000, how would I write a script to detect this and say there is an error?
I appreciate any help I can get! Thanks

Antworten (2)

dpb
dpb am 3 Jul. 2013
Use diff() on the responses and look for zeros in consecutive locations.
How to determine the time is dependent on how it is recorded; you don't give enough info to tell.

Jan
Jan am 4 Jul. 2013
You can use FEX: RunLength to get the number of repetitions:
x = randi(5, 1, 1000);
[value, repetition, index] = RunLength(x);
sticky = find(repetitions > 60);

Community Treasure Hunt

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

Start Hunting!

Translated by