| Contents | Index |
tic
ticID = tic
tic starts a stopwatch timer. Stop the timer with the toc function.
ticID = tic stores an identifier for the tic command, so that you can nest timing operations.
Consecutive tic commands overwrite the internally recorded starting time.
The clear function does not reset the starting time recorded by a tic command.
ticID |
Value to use as an input argument for a subsequent call to toc. The value has no independent meaning. |
Measure how the time required to solve a linear system varies with the order of a matrix:
t = zeros(1,100);
for n = 1:100
A = rand(n,n);
b = rand(n,1);
tic
x = A\b;
t(n) = toc;
end
plot(t)Measure the minimum and average time to compute a summation of Bessel functions:
REPS = 1000; minTime = Inf; nsum = 10;
tic;
for i=1:REPS
tStart = tic; total = 0;
for j=1:nsum,
total = total + besselj(j,REPS);
end
tElapsed = toc(tStart);
minTime = min(tElapsed, minTime);
end
averageTime = toc/REPS;clock | cputime | etime | profile | toc

Explore how to use MATLAB to make advancements in engineering and science.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |