Fresnel diffraction in two stages

I wrote a short matlab script file that would suggest running Fresnel propagation (diffraction), so for a given input field U0, it will tell you how the field looks after distance z0. I compared the result with the results of textbooks, and it seems that my program works fine. The problem is that I am trying to complete two distribution steps instead of one. that is, instead of one iteration of the program for spreading the distance z0, I take two iterations of the program for spreading the distance z0 / 2 each. Then I get complete nonsense, and I cannot understand what the problem is. Any advice would be greatly appreciated. Here is the code:

function U = fresnel_advance (U0, dx, dy, z, lambda)
% The function receives a field U0 at wavelength lambda
% and returns the field U after distance z, using the Fresnel
% approximation. dx, dy, are spatial resolution.

k=2*pi/lambda;
[ny, nx] = size(U0); 

Lx = dx * nx;
Ly = dy * ny;

dfx = 1./Lx;
dfy = 1./Ly;

u = ones(nx,1)*((1:nx)-nx/2)*dfx;    
v = ((1:ny)-ny/2)'*ones(1,ny)*dfy;   

O = fftshift(fft2(U0));

H = exp(1i*k*z).*exp(-1i*pi*lambda*z*(u.^2+v.^2));  

U = ifft2(O.*H);  
+4
source share
2

fft2 fftshift, .

ifft2, , (1,1). , .

, U = ifft2(fftshift(O.*H)) .

, Matlab ifftshift fftshift insteaf ifftshift ( , ). , ifftshift(fftshift(X)) ifftshift(fftshift(X)) .

, : U = ifft2(ifftshift(O.*H)) .

+3

, , .

, , FFTSHIFT . , "", , FFT2, " " . FFTSHIFT FFT2, .

IFFT2.

FFTSHIFT: :

N = 512; [x,y] = meshgrid(-1:1/N:(N-1)/N);
mask = (x.*x + y.*y) < 0.001;
figure(1)
imagesc(angle(fftshift(fft2(fftshift(mask)))))
figure(2)
imagesc(angle(fftshift(fft2(mask)))
+2

All Articles