% % % This script calculates the OTF and PSF for an aperture % % % In these simulations, we choose to work in units of wavelength*2*10^3 % (mm if the wavelength is 5 microns) % range=.5; npoints=256; step=range/npoints; lamda=5*10^(-4); imagedistance=10; scale=-range/2:step:range/2-step; ftscale=(npoints/range^2)*scale; [x,y]=meshdom(scale,scale); [fx,fy]=meshdom(ftscale,ftscale); coherentH=pup(-lamda*imagedistance*fx,-lamda*imagedistance*fy); psf=abs(fftshift(ifft2(fftshift(coherentH)))).^2; otfp=fftshift(fft2(fftshift(psf))); figure(1); colormap('hot'); imagesc(scale,scale,psf); axis('square'); figure(4); plot(scale,abs(psf(npoints/2,:))); figure(2); colormap('hot'); imagesc(ftscale,ftscale,abs(otfp)); axis('square'); figure(5); plot(ftscale,abs(otfp(npoints/2,:))); figure(3); colormap('hot'); imagesc(ftscale,ftscale,abs(coherentH)); axis('square');