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

    %% Dot Product of Multidimensional Arrays  

%% 
% Create two multidimensional arrays. 
A = cat(3,[1 1;1 1],[2 3;4 5],[6 7;8 9])

%%
B = cat(3,[2 2;2 2],[10 11;12 13],[14 15; 16 17])  

%% 
% Calculate the dot product of |A| and |B| along the third dimension (|dim
% = 3|).
C = dot(A,B,3) 

%%
% The result, |C|, contains four separate dot products. The first dot
% product, |C(1,1) = 106|, is equal to the dot product of |A(1,1,:)| with
% |B(1,1,:)|.