Error in example of counting complex events?

1 visualizzazione (ultimi 30 giorni)
Hello folks,
I was going through the example of counting complex events in matlab environment. I followed example given below;
href = ""<http://www.mathworks.se/help/daq/examples/counting-complex-events-using-analog-input-data.html?prodcode=DA&language=en</a>>
If you scroll down to see the pulse duration, there will be a section where they counted the duration of each pulse.
Find the Duration of Each Pulse
A switch bounce is represented by a very short duration pulse. To find the duration of each pulse, you need to combine the rising edge and falling edge times into a single vector. The difference of any two consecutive times shows the duration of a pulse.
% Construct a vector to hold all of the times.
pulseIndices = zeros(length(risingEdge) * 2, 1);
% Store the rising edge times.
pulseIndices(1:2:end) = risingEdge;
% Store the falling edge times.
pulseIndices(2:2:end) = fallingEdge;
% Compute the pulse durations.
pulseTimes = diff(time(pulseIndices))
The image shows 15 pulses, and the dataset of pulseTimes show 30. What is this number? Is it T_on and T_off values?
I wish to know the pulse duration. Am I looking at the right code?

Risposta accettata

xsystem1
xsystem1 il 1 Ott 2012
I found out the pulse duration by subtracting falling edge and risingedge. Thanks.

Più risposte (0)

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by