Summary: In MATLAB, one should always try to avoid using loops. This module introduce the concept of vectorization.
ssum.a = 1:1000; b = 1000 - a; ssum=0; for n=1:1000 %poor style... ssum = ssum +a(n)*b(n); endRecognizing that the sum is the inner product of the vectors
ssum = a*b' %Vectorized, better!
Comments, questions, feedback, criticisms?