function show_diffraction(img_source, xpos_s, ypos_s, img_target, xpos_t, ypos_t) [Ny_s,Nx_s] = size(img_source); [Ny_t,Nx_t] = size(img_target); % plot mask image figure(1); x_s=linspace(xpos_s(1), xpos_s(end), Nx_s); y_s=linspace(ypos_s(1), ypos_s(end), Ny_s); imagesc(x_s,y_s, abs(img_source).^2); colorbar; colormap('gray'); xlabel('x (m)'); ylabel('y (m)'); title('mask image'); % plot diffraction image figure(2); x_t=linspace(xpos_t(1), xpos_t(end), Nx_t); y_t=linspace(ypos_t(1), ypos_t(end), Ny_t); % I use gamma correction due to luck of the display dynamic range % pixel brightness correction, display dependent %gamma=1/4; gamma=1; imagesc(x_t, y_t, (abs(img_target).^2).^(gamma)); colorbar; colormap('gray'); xlabel('x (m)'); ylabel('y (m)'); title('target image');