This is my code for generating the CGH mask for point image. How do I get the ring pattern?
clc;
clear all;
pixpitch=8e-6;
x=-3.068e-3:pixpitch:3.068e-3; %length(x)=768
y=-4.096e-3:pixpitch:4.088e-3; %length(y)=1024
lambda=0.4e-6;
z=0.1;
b=0;
H=zeros(length(x),length(y));
r=zeros(length(x),length(y));
phase=zeros(length(x),length(y));
for k=x %for 768x1024 res
c=0;
b=b+1;
for j=y %for 768x1024 res
c=c+1;
r(b,c)=sqrt((k^2)+(j^2));
H(b,c)=exp(1i*(pi*r(b,c).^2)/(lambda*z));
phase(b,c)=angle(H(b,c));
end
end
figure; imagesc(x,y,phase)
Rmax=(lambda*z)/(2*pixpitch);
[y2 x2] = meshgrid(y,x);
aprtr = sqrt((x2).^2+(y2).^2)<Rmax;
loc_diff_pat = phase.*aprtr;
figure; imagesc(x,y,loc_diff_pat) % localised diffraction pattern