Skip to content

Instantly share code, notes, and snippets.

@vertexclique
Created June 4, 2011 09:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vertexclique/1007766 to your computer and use it in GitHub Desktop.
Save vertexclique/1007766 to your computer and use it in GitHub Desktop.
dot product
function y = dot(a,b)
if length(a) == length(b)
size = length(a);
if size < 2
error('The vectors size must greater than one');
end;
else
error('Vectors size not equal each other');
end;
total= 0;
for i= 1:size
total= total + ( a(i)*b(i) );
end;
y = total;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment