clear;
%
% This program implements figure 5 of Yellot 93'
% A new counter example to the Julesz Conjecture
% 2-D version example
%
  t=[0 0 0 0 1 0 0 0 0;
     0 0 0 0 1 0 0 0 0;
     0 0 1 1 1 1 1 0 0;
     0 0 1 0 0 0 1 0 0;
     0 1 1 1 0 1 1 1 0;
     0 1 0 0 1 0 0 1 0;
     0 1 0 0 1 0 0 1 0;
     1 1 1 1 1 1 1 1 1];
it=[ 0 0 0 1 1 1 0 0 0;
     0 0 0 0 1 0 0 0 0;
     0 1 1 1 1 1 1 1 0;
     0 0 1 0 0 0 1 0 0;
     0 0 1 0 0 0 1 0 0;
     1 1 1 1 1 1 1 1 1;
     0 1 0 0 1 0 0 1 0;
     0 1 0 0 1 0 0 1 0];
  
p=zeros(45,45);
for i=0:4
   for j=0:4
      p(i*10+5,j*10+5)=1;
   end;
end;
  
i1=conv2(p,t);
i2=conv2(p,it);
R1=AutoCorr2(i1);
R2=AutoCorr2(i2);
[M,N]=size(R1);
if (R1-R2==zeros(M,N))
   AutoCorr2Equal=1
else
   AutoCorr2Equal=0
end;
save fig5;
figure(1);
subplot(1,2,1);
AutoImage(i1);
subplot(1,2,2);
AutoImage(i2);
