function x = vecDot(a, b) % vecDot - Dot product for vectors in R2 % % % Syntax: % x = vecDot(a, b) % Arguments: % a - The first vector % b - The second vector % Returns: % x - The scalar product of a and b % % Description: % % Computes the scalar product between two vectors in R2 % % See also: % %---------------------------------------------------------------------- % Bugs: % % Date created: % 990910 % Author: % Marten Levenstam % % Change history: % % +---------------------------------------+ % | Matematik Kf/Kb 1999-2000 | % | Copyright (c) 1999 | % | | % | Marten Levenstam | % | Klas Samuelsson | % | Dep. of Mathematics | % | Chalmers University of Technology | % | S-412 96 Gothenburg | % | SWEDEN | % | martenl@math.chalmers.se | % | | %------------------------------+---------------------------------------+ if vecIsInR2(a) & vecIsInR2(b) x = a(1)*b(1) + a(2)*b(2); else error('vecDot: a or b is not in R2'); end