Two measures of the efficiency of an algorithm are the number of
floating point operations (flops) performed and the elapsed time.
The MATLAB function
The MATLAB function , t2etime( gives
the elapsed time from t2,t1) to t1. One can for
example, measure the time required to solve a given linear system t2Ax
= b using Gaussian elimintation as follows:
t = clock; x = A\b; time = etime(clock,t)You may wish to compare this time---and flop count---with that for solving the system using .
Try it! Others related commands are x = inv(A)*b;tic and toc.
It should be noted that, on timesharing machine, |