help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: pause(.01) gives a mean pause of 0.0102 and not 0.0100 seconds


From: Przemek Klosowski
Subject: Re: pause(.01) gives a mean pause of 0.0102 and not 0.0100 seconds
Date: Wed, 16 Oct 2019 17:02:05 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1

On 10/16/19 4:47 PM, GoSim wrote:
I use octave as a real time controller and use pause() to get my desired
sample time. When I want to get a sample time of 0.01 seconds I get a mean
pause of 0.0102 seconds. I tried pause(0.0100000) with the same result. I
don't know if it is fixable or if it is a bug but I just wanted to make you
aware.

I attach a picture with the sample time in a real time environment and you
can also see the command
tic;pause(.01);toc in the octave console giving the same result.

The real time environment is achieved with the chrt command in xubuntu.

The graph in the pic shows the sample time which should 0.01 seconds.

I hope you fix it! Kind regards.

I am actually quite impressed how good it is!

I don't think it's realistic to expect much better results. Note that tic;command;toc measures the time to execute the command PLUS half of the time to execute the pair tic; toc. The occasional deviation is also quite hard to avoid, and is not really Octave's fault---it has to do with the inherent timing variations in all the components of your system, from CPU and the memory subsystem to all the peripherals, and various data management functions in the interpreter.

No milisecond-resolution real time loops in interpreted languages, I'm afraid. My advice would be to rewrite your code to run the realtime loop in a dedicated process compiled from say C, that is sharing data with a separate Octave process.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]