Timer Objects - more precise alternative ?

3 views (last 30 days)
Hello,
First of all I am using the Matlab 2011a version.
The Timer Objects are only precise to the second so is there any more precise alternative to them ?
I use them to start function at a certain time and need to be precise at least at the milliseconds or more.
I was thinking about a loop looking at the value of Toc as I didn't find any native function doing this.
Thanks for your time.

Accepted Answer

Benjamin Kraus
Benjamin Kraus on 9 Nov 2017
Edited: Benjamin Kraus on 9 Nov 2017
You are going to have trouble getting millisecond precision with any application that isn't running with special priority in the operating system, because the operating system itself may interrupt MATLAB at any time. Can you give more details about your application? Maybe there is another approach that you can consider.
  1 Comment
Stephen23
Stephen23 on 15 Nov 2017
Lucien Robinault's "Answer" moved here:
Sorry for the delay. The timer is used to stop a linear actuator. Some potentiometer are bond to it but I first need to get a view of their behaviour on the full range of motion of the actuator to use them to monitor it. I used a TIC-TOC loop, it block the execution of the script but it work for what I need : i get enough precision not to block the actuator and to stop it with enough precision.
if true
tic;
while true
if toc > delay
putdata(obj,[0;10]);
start(obj);
break
end
end
stop(analIn);
end
end
with delay : time needed to full ROM (i can estimate it fairly precisely given the length and speed of the actuator) obj : it is the analog output who send command to the actuator. It goes through a NIDAQ - USB 6229.

Sign in to comment.

More Answers (0)

Categories

Find more on General Applications in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!