How do I find the Time at which an Event occurs?
1 次查看(过去 30 天)
显示 更早的评论
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.
回答(2 个)
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."
0 个评论
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.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!