function z = union(x,y)

%    usage:  z = union(x,y)
%  purpose:  to form the union of the 'sets' x and y
%   extern:
%   author:  Risto Rauhala, Tampere University of Technology, Finland

z = sort([x(:)' y(:)']); n = length(z);

if n > 1
   z([0 ~(z(2:n)-z(1:n-1))]) = [];
end
