fx1=3.5;fy1=2;
fx2=7;fy2=2;
fx3=10.5;fy3=2;
fx4=14;fy4=2;
fx5=17.5;fy5=2;
fx6=21;fy6=2;
fx7=24.5;fy7=2;
fx8=28;fy8=2;
fx9=31.5;fy9=2;
fx10=35;fy10=2;
fx11=38.5;fy11=2;
fx12=42;fy12=2;
fx13=45.5;fy13=2;
fx14=49;fy14=2;
fx15=52.5;fy15=2;
fx16=56;fy16=2;
[x1,y1]=meshgrid(-1:2/511:1, -1:2/511:1);
circ1=sqrt(x1.^2+y1.^2)<1;
z4=(sqrt(3).*(2.*(x1.^2+y1.^2)-1));
figure(1)
imagesc(z4); colormap gray; axis image; axis off
M=zeros(512);
a=128;
b=128;
[x,y]=meshgrid(-1:2/127:+1, -1:2/127:+1);
circ=sqrt(x.^2+y.^2)<1;
h1=circ.*(cos((x*pi*fx1)+(y*pi*fy1)))>0;
h2=circ.*(cos((x*pi*fx2)+(y*pi*fy2)))>0;
h3=circ.*(cos((x*pi*fx3)+(y*pi*fy3)))>0;
h4=circ.*(cos((x*pi*fx4)+(y*pi*fy4)))>0;
h5=circ.*(cos((x*pi*fx5)+(y*pi*fy5)))>0;
h6=circ.*(cos((x*pi*fx6)+(y*pi*fy6)))>0;
h7=circ.*(cos((x*pi*fx7)+(y*pi*fy7)))>0;
h8=circ.*(cos((x*pi*fx8)+(y*pi*fy8)))>0;
h9=circ.*(cos((x*pi*fx9)+(y*pi*fy9)))>0;
h10=circ.*(cos((x*pi*fx10)+(y*pi*fy10)))>0;
h11=circ.*(cos((x*pi*fx11)+(y*pi*fy11)))>0;
h12=circ.*(cos((x*pi*fx12)+(y*pi*fy12)))>0;
h13=circ.*(cos((x*pi*fx13)+(y*pi*fy13)))>0;
h14=circ.*(cos((x*pi*fx14)+(y*pi*fy14)))>0;
h15=circ.*(cos((x*pi*fx15)+(y*pi*fy15)))>0;
h16=circ.*(cos((x*pi*fx16)+(y*pi*fy16)))>0;
M(1:a, 1:b) = h1;
M(1:a, b+1:b*2) = h2;
M(1:a, 2*b+1:b*3) = h3;
M(1:a, 3*b+1:b*4) = h4;
M(a+1:a*2, 1:b) = h5;
M(a+1:a*2, b+1:b*2) = h6;
M(a+1:a*2, 2*b+1:b*3) = h7;
M(a+1:a*2, 3*b+1:b*4) = h8;
M(2*a+1:a*3, 1:b) = h9;
M(2*a+1:a*3, b+1:b*2) = h10;
M(2*a+1:a*3, 2*b+1:b*3) = h11;
M(2*a+1:a*3, 3*b+1:b*4) = h12;
M(3*a+1:a*4, 1:b) = h13;
M(3*a+1:a*4, b+1:b*2) = h14;
M(3*a+1:a*4, 2*b+1:b*3) = h15;
M(3*a+1:a*4, 3*b+1:b*4) = h16;
figure(2)
imagesc(M),colormap gray; axis image; axis off
title('Array Of 4x4 Holograms');