Calculating Time Between Binary Ticks

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!

답변 (0개)

카테고리

질문:

2017년 11월 20일

편집:

2017년 11월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by