MATLAB: Nano second

radio frequency

I am still confused about the access time on the order of nano second.how matlab can have accurate time in order of nano second.

Best Answer

Even microseconds are not valid in Matlab, if you measure them using CLOCK or CPUTIME: See CSSM: Precision of CLOCK and CPUTIME.
The 1000th parts of the seconds between subsequent calls of CPUTTIME and CLOCK are correlated:
function sillyTest
a = cputime;
v = rand(1000); % Any operation wasting some time
% drawnow; % Waste more time
b = cputime;
fprintf('%f %.3f\n%f %f.3\n', a, rem(a*100, 1), b, rem(b*100, 1);
While the 10th and 100th parts of the seconds are independent, the 1000th parts are monotonically increasing (execpt for overflow) - at least in Matlab 2009a. The same problem appears for CLOCK.
Related Question