Why is timer object firing at an incorrect frame rate?
6 次查看(过去 30 天)
显示 更早的评论
I am using a timer object to try to enforce a frame rate of 25 Hz (0.04 seconds per period) for a few minutes. When I use tic/toc to see how long each 25-frame "second" takes, it is not one second. The time-per-second depends on what I have running in the TimerFcn. I have seen a string of 1.1-second "seconds", and other times there are strings of 0.92-second "seconds".
I am confused because when I use the "AveragePeriod" method, the timer always thinks it has perfect timing, and has an average period of 0.04 seconds. Even if the actual periods seem to be 10% off. Does the timer use a completely different system than the tic/toc functions?
I am running it in 'FixedRate' mode, so it should run the TimerFcn every 0.04 seconds. I have tried it with both 'drop' and 'queue' options for the BusyAction.
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Entering Commands 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!