Getting Started Previous page   Next Page

Vectorization

One way to make your MATLAB programs run faster is to vectorize the algorithms you use in constructing the programs. Where other programming languages might use for loops or DO loops, MATLAB can use vector or matrix operations. A simple example involves creating a table of logarithms.

A vectorized version of the same code is

For more complicated code, vectorization options are not always so obvious.


Previous page  Function Functions Preallocation Next page

© 1994-2005 The MathWorks, Inc.