Calculating Time Between Binary Ticks

1 vue (au cours des 30 derniers jours)
Karam Elabd
Karam Elabd le 20 Nov 2017
Modifié(e) : Karam Elabd le 20 Nov 2017
Hello,
I am trying to calculate the time between a set of binary ticks to determine the onset of an activity from data provided by a sensor.
The sensor is an optical encoder that fluctuates (or ticks) between 1's and 0's whenever the encoder rotates. My objective is to determine the time between these ticks. The binary value provided by the encoder is of no interest, but rather the rate at which it is revolving.
Here are a couple of examples that may help with my explanation.
encoderArray_Example1 = [1 0 1 0 1 1 1 0 0 0 0 1 0 0 1 1]; %These are binary states timeBetweenTicks_Example1 = [1 1 1 1 3 4 1 2 2]; %The result here is in units of time
encoderArray_Example2 = [1 1 1 0 0 0 0 1 1 0 1 0]; %These are binary states timeBetweenTicks_Example2 = [3 4 2 1 1 1]; %The result here is in units of time
Thanks!

Réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by