function A = dirsum(A,varargin)
% DIRSUM Direct sum of matrices
%        C = DIRSUM(A1,A2,...,An)
%        Peter Arbenz, May 30, 1997.
for k=1:length(varargin)
   [n,m] = size(A);
   [o,p] = size(varargin{k});
   A = [A zeros(n,p); zeros(o,m) varargin{k}];
end

