# optical fourier transform by free space propagation and lens

43 views (last 30 days)
daniel dahan on 18 Apr 2016
Edited: Walter Roberson on 13 Oct 2016
hi, I want to simulate an optical fourier transform by free space propagation and lens. I have wrote functions for a lens-phase and for propagation, but the result desn't match to the theory. The code appears in my next post.
##### 2 CommentsShowHide 1 older comment
daniel dahan on 19 Apr 2016
you are right. here is my new code:
clear;close all;clc
% setting input field:
nx = 350;% num of samples
dx0 = 5e-2;%[m]
x0 = (-nx/2:nx/2-1)*dx0;% source-plane coordinates
U0 = cos(x0);%input field structure
figure;plot(x0,U0)
%
% propagation from z=0 to z1:
z = 50e-3;%[m]
lambda = 0.5e-6;%[m]
k = 2*pi/lambda; % optical wavevector
U1 = dx0*conv(U0,(1j*z./(lambda*(z^2+x0.^2))).*exp(-1j*sign(z)*k*sqrt(z^2+x0.^2)));
xout = length(U1);
U1 = U1(floor((xout-nx)/2):floor((xout+nx)/2 -1));
dx1 = lambda*z/(nx*dx0);
x1 = (-nx/2:nx/2-1)*dx1;% observation-plane coordinates
%
% lens:
U2 = U1.*exp(-1i*k/(2*z)*(x1.^2));
%
% propagation from z1 to z2 (z1 = z2 = focal length):
U3 = dx1*conv(U2,(1j*z./(lambda*(z^2+x1.^2))).*exp(-1j*sign(z)*k*sqrt(z^2+x1.^2)));
xout = length(U3);
U3 = U3(floor((xout-nx)/2):floor((xout+nx)/2 -1));
dx2 = lambda*z/(nx*dx1);
x3 = (-nx/2:nx/2-1)*dx2;% observation-plane coordinates
%
figure;plot(x3,abs(U3))

Rick Rosson on 19 Apr 2016
Edited: Rick Rosson on 19 Apr 2016
I am not exactly sure what the source of the problem is, but I have a few suggestions to help you diagnose the root cause:
First, please change the definition of U0 as follows:
U0 = exp(1j*x0);%input field structure
Second, in the next line, when you plot U0, please use the following:
figure; plot(x0,real(U0),x0,imag(U0));
Third, just before computing U2, insert the following intermediate plot:
figure; plot(x1,real(U1),x1,imag(U1));
Fourth, just after computing U2, insert this intermediate plot:
figure; plot(x1,real(U2),x1,imag(U2));
Finally, at the very end, when you plot U3, please use the following:
figure; plot(x3,real(U3),x3,imag(U3));
After reviewing each of these figures, it appears to me that the computation of U1 and U2 seem to be working just fine, but there is something that is not working in the computation of U3. I suspect it may have something to do with how you compute either dx1 and/or x1, but I am not really sure. Maybe the plots will help you figure out what the issue is.
HTH.

dhivya priya on 13 Oct 2016
how could u set the input field structure? and my question is how should i change the code when i m having an input image at the object plane.,.