Why is timer object firing at an incorrect frame rate?
3 views (last 30 days)
Show older comments
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.
3 Comments
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!