summaryrefslogtreecommitdiff
path: root/demo_diffraction_on_a_disk.m
diff options
context:
space:
mode:
Diffstat (limited to 'demo_diffraction_on_a_disk.m')
-rw-r--r--demo_diffraction_on_a_disk.m36
1 files changed, 30 insertions, 6 deletions
diff --git a/demo_diffraction_on_a_disk.m b/demo_diffraction_on_a_disk.m
index 49c2aff..a066da6 100644
--- a/demo_diffraction_on_a_disk.m
+++ b/demo_diffraction_on_a_disk.m
@@ -12,7 +12,7 @@ ypos_s=linspace( -src_size, src_size, Ny_s);
[xmesh,ymesh]=meshgrid(xpos_s,ypos_s);
w=0.0014*3/2;
-R=1;
+R=.3; % positive R is focusing along propagation
z_before_mask=LaguerreGaussianE([0,0,q_(w,R,lambda),lambda],xmesh,ymesh,'cart');
% disk mask
@@ -24,14 +24,33 @@ img_source= z_before_mask .* mask;
%img_source= z_before_mask;
-% set up target image
+%% set up target image
+% square image
Nx_t=101;
Ny_t=101;
img_t=zeros(Ny_t,Nx_t);
-tgt_size = 2*12.5e-3;
-xpos_t=linspace( -tgt_size, tgt_size, Nx_t);
-ypos_t=linspace( -tgt_size, tgt_size, Ny_t);
-z_t=10;
+tgt_size_x = 12.5e-3;
+tgt_size_y = tgt_size_x;
+xpos_t=linspace( -tgt_size_x, tgt_size_x, Nx_t);
+ypos_t=linspace( -tgt_size_y, tgt_size_y, Ny_t);
+
+% one quadrant, suitable for symmetrical images
+%xpos_t=linspace( 0, tgt_size, Nx_t);
+%ypos_t=linspace( 0, tgt_size, Ny_t);
+
+% slice along x axis for radial simmetry
+%ypos_t=linspace( 0, 0, Ny_t);
+
+%% full image which mimics camera
+Nx_t=101; % use Nx_t = 680 to mimic camera
+Ny_t=int32(Nx_t*(480/640));
+img_t=zeros(Ny_t,Nx_t);
+tgt_size_x = (640*7e-6)/2; % each pixel is 7 um
+tgt_size_y = (480*7e-6)/2;
+xpos_t=linspace( -tgt_size_x, tgt_size_x, Nx_t);
+ypos_t=linspace( -tgt_size_y, tgt_size_y, Ny_t);
+
+z_t=.50;
% generating image of the mask accounting the diffraction
@@ -39,5 +58,10 @@ tic; % start timer
img_t=diffracted_image_at_target(img_source, xpos_s, ypos_s, img_t, xpos_t, ypos_t, z_t, lambda);
toc % show evaluation time
+imwrite(img_t/max(img_t(:)),'diffracted_image.png')
+
% plot source and target images
show_diffraction(img_source, xpos_s, ypos_s, img_t, xpos_t, ypos_t);
+
+% radial slice of the target image
+figure(3); plot( xpos_t, abs( img_t(1,:) ) )