% light wavelength lambda=795e-9; % Rb D1 line % set up mask (source image) Nx_s=301; Ny_s=301; img_source=zeros(Ny_s,Nx_s); src_size = 1.0*12.5e-3; xpos_s=linspace( -src_size, src_size, Nx_s); ypos_s=linspace( -src_size, src_size, Ny_s); [xmesh,ymesh]=meshgrid(xpos_s,ypos_s); w=0.0014*3/2; R=.3; % positive R is focusing along propagation z_before_mask=LaguerreGaussianE([0,0,q_(w,R,lambda),lambda],xmesh,ymesh,'cart'); % disk mask mask_R = (w*0.33); mask = mask_transparency(xmesh,ymesh, mask_R); % resulting field after mask img_source= z_before_mask .* mask; %img_source= z_before_mask; %% set up target image % square image Nx_t=101; Ny_t=101; img_t=zeros(Ny_t,Nx_t); tgt_size_x = 0.2*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=640; % 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); %% propagation distance z_t=.50; % generating image of the mask accounting the diffraction 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 dstr = datestr(now,'yyyymmdd-HH:MM:SS'); fname = strcat('diffracted_image', '_', dstr, '.png'); img_t_intensiry = abs(img_t/max(img_t(:))).^2; imwrite(img_t_intensiry, fname); % 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( ceil(Ny_t/2),:) ) )