function x = dotProd( a, b ) % =========================================== % Purpose: compute the dot product of two vectors % Syntax: x = dotProd( a, b ) % Inputs: a = vector % b = vector % Output: x = a * b % =========================================== m = length( a ); k = length( b ); if ( m~=k ), x = 'ERROR: vector dimensions do not agree'; return, end x = 0; for i=1:m, x = a( i ) * b( i ) + x; end