How do I find the Time at which an Event occurs?

2 ビュー (過去 30 日間)
Peter
Peter 2012 年 4 月 4 日
For my data, I have Throttle Position vs. Time. (sampled at 80Hz).
For most of the run, throttle position is varying around 30%, then near the end of the run throttle is quickly advanced to 100% (sometimes to 150%).
I need to find the time at which the throttle is starting to advance to 100%.
Here's what I'm trying, but I can't get it to work for me (etr_cmd is Throttle Position):
for x = 1:size(etr_cmd,1)
wave_start = diff(etr_cmd);
if (wave_start == 1.0)
time_row1 = x;
end
end
Any Help would be greatly appriciated.
  1 件のコメント
Thomas
Thomas 2012 年 4 月 4 日
can you show your data?

サインインしてコメントする。

回答 (2 件)

Pan
Pan 2012 年 4 月 4 日
In my studies, I use a function named "GetSecs", which returns "the time in seconds (with high precision)". Plus, "GetSecs uses the highest precision realtime clock on each operating system."

Walter Roberson
Walter Roberson 2012 年 4 月 4 日
Will the change in throttle really be 1.0 exactly? Is your data quadrature encoded or something like that? It would seem more likely that etr_cmd would become 1.0 or greater when the throttle reaches 100%, but that the immediately previous position could be anywhere from ~0.3 upwards, leading to a diff() of 0.7 downward ??
find(etr_cmd >= 1.0, 1)
would seem like what you want.

カテゴリ

Help Center および File ExchangeTiming and presenting 2D and 3D stimuli についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by