summaryrefslogtreecommitdiff
path: root/examples/LGIplot.m
blob: 4ed244c33a9be75bf4de751bdeed44acaf45d206 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
% Illustrates the use of LaguerreGaussianE.m by plotting the 
% first 16 Laguerre-Gaussian modes (p,m)=([0:3],[0:3]).

pnumbers=[0:3];
mnumbers=[0:3];
pmax=max(pnumbers);
mmax=max(mnumbers);

w=1;
R=1e6;
n=4;

for p=0:pmax
for m=0:mmax
    
nrad=240;
ntheta=240;
rseed=linspace(0,sqrt(n*w),nrad).^2;
thetaseed=linspace(0,360,ntheta)*pi/180;

[theta,r]=meshgrid(thetaseed,rseed);

[x,y]=pol2cart(theta,r);

subplot(pmax+1,mmax+1,p*(mmax+1)+m+1)
h=pcolor(x,y,abs(LaguerreGaussianE([p,m,q_(w,R),1e-6],r,theta,'pol')+LaguerreGaussianE([p,-m,q_(w,R),1e-6],r,theta,'pol')).^2);
colormap('bone')
set(gca,'Visible','off');
set(gcf,'Color','black');
shading interp;
%figtext(4.3,-0.7,['(',num2str(p),',',num2str(m),')'],8);
axis square
hold off
shg;

end
end