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

    %% Block Diagonal Matrix  
% Create a block diagonal matrix.   

%% 
% Create a 4-by-4 identity matrix and a 2-by-2 matrix that you want to be
% repeated along the diagonal. 
A = eye(4);
B = [1 -1;-1 1];  

%% 
% Use |kron| to find the Kronecker tensor product. 
K = kron(A,B) 

%%
% The result is an 8-by-8 block diagonal matrix.