how do i simulate a 4f correlator

15 views (last 30 days)
eden london
eden london on 9 Jun 2016
Answered: eden london on 9 Jun 2016
im trying to simulate a 4f correlator, and for some reason i cant get it to work. The code that simulates the 4f correlator is this:
[xgrid ygrid]=meshgrid(1:1024);
grid=(xgrid-512).^2 +(ygrid-512).^2;
lens=exp((1i*pi*(pixsize^2)/((-f)*w)).*grid);
move=fft2(exp((1i*pi*(pixsize^2)/(f*w)).*grid));
img=padarray(h1cof,[pf pf]);
bl1=ifftshift(ifft2(fft2(img).*move));
al1=bl1.*lens;
bh2=ifftshift(ifft2(fft2(al1).*move));
ah2=bh2.*padarray(h2ft,[pf pf]);
bl2=ifftshift(ifft2(fft2(ah2).*move));
al2=bl2.*lens;
rescof=ifftshift(ifft2(fft2(al2).*move));
where f is the focal length and w the wavelength

Answers (1)

eden london
eden london on 9 Jun 2016
I think the problem might be due to scaling in the fourier domain. can't seem to solve it though..

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!