function z=join(x,y)

%
% Computes the join of lattice intervals x and y. 
% 
% z=join(x,y)
%
% x,y,z are 2m-dimensional column vectors
%

n=size(x,1)/2;
p1=[1:n]; p2=[n+1:2*n];

z=[min(x(p1),y(p1));max(x(p2),y(p2))];


return
% visualizando
figure(1); clf;
fill(z([1 3 3 1]),z([2,2,4,4]),'c'); hold on
fill(y([1 3 3 1]),y([2,2,4,4]),'b')
fill(x([1 3 3 1]),x([2,2,4,4]),'r')
hold off