from pylab import * from rectangular import * def fra (z,wl): dxi = 0.1 xi = arange(-10,10,dxi) a = (len(xi)/2) m = arange(-a,a) M = len(m) wx = 5 U1 = rect(xi/(2*wx))/(2*wx) ## plot function subplot(2,2,1) plot(xi,U1) ft = fftshift(fft(U1)) ## plot fourier transform subplot(2,2,2) plot (xi,ft) k = (2*pi)/wl p = m dx = (wl*z)/(dxi*M) x = p*dx ##phase calculation pIs = exp(1j*z*k)/(1j*wl*z) pDs = exp((1j*k*(x**2))/(2*z)) U2 = pIs*pDs*ft ##Brake down of insensity calculation A = 2*wx b = wl*z I = (((A/b))*(sinc((A*x)/b)))**2 subplot(2,2,3) plot (x,I) ## plot calculated Intensity and Intensity subplot(2,2,4) plot (x,U2*U2.conj()) #plot (x,I)