www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/DotProductofRealVectorsExample.m

    %% Dot Product of Real Vectors  

%% 
% Create two simple, three-element vectors. 
A = [4 -1 2];
B = [2 -2 -1];  

%% 
% Calculate the dot product of |A| and |B|. 
C = dot(A,B) 

%%
% The result is |8| since 
%
%    C = A(1)*B(1) + A(2)*B(2) + A(3)*B(3)
%