% Hermite Gaussian mode w0=5; % number of smaple points nx = 256; xrange = 10* w0; delta_x = 2.*xrange / nx; frange = 1./ delta_x / 2.; delta_f = frange / nx; % colormap(gray(256)); for n = 1:256 g(n) = log(n)/log(256); graylog(n,:) = [ g(n) g(n) g(n) ]; end colormap(graylog); x=-xrange:delta_x:xrange; y=x; [X,Y] = meshgrid(x,y); R=X.^2+Y.^2; xarg = sqrt(2)*X./w0; yarg = sqrt(2)*Y./w0; %m=0 %n=0 Efield= exp(-R/w0.^2); Inten=Efield.*conj(Efield); norm=256/max(max(Inten)); subplot(3,2,1); Inten=Efield.*conj(Efield); norm=256/max(max(Inten)); subplot(3,2,1); image(x,y,Inten*norm); title('HG(m=0,n=0)') axis('square'); % Far field xf=-frange:delta_f:frange; yf=xf; U=fft2(Efield); UF=U.*conj(U); UF=fftshift(UF); norm=256/max(max(UF)); subplot(3,2,2); image(xf,yf,UF*norm); title('HG(m=0,n=0) far field') axis('square'); %m=1 %n=3 Hm=2*xarg; Hn=8*yarg.^3-12*yarg; Efield= Hm.*Hn.*exp(-R/w0.^2); Inten=Efield.*conj(Efield); norm=256/max(max(Inten)); subplot(3,2,5); image(x,y,Inten*norm); title('HG(m=1,n=3)') axis('square'); % Far field U=fft2(Efield); UF=U.*conj(U); UF=fftshift(UF); norm=256/max(max(UF)); subplot(3,2,6); image(xf,yf,UF*norm); title('HG(m=1,n=3) far field'); axis('square'); %m=0 %n=0 %Elliptic beam R=X.^2+4.*Y.^2; Efield= exp(-R/w0.^2); Inten=Efield.*conj(Efield); norm=256/max(max(Inten)); subplot(3,2,3); image(x,y,Inten*norm); title('HG(m=0,n=0) elliptic'); axis('square'); % Far field U=fft2(Efield); UF=U.*conj(U); UF=fftshift(UF); norm=256/max(max(UF)); subplot(3,2,4); image(xf,yf,UF*norm); title('HG(m=0,n=0) elliptic far field'); axis('square');