forked from azopticsinc/diffractive-optical-elements
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update_date_01_25_2021_timestamp_11_11_00_PM
- Loading branch information
Showing
80 changed files
with
2,560 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
%% 4-level 1D grating | ||
clear %Clear all memory | ||
|
||
% Defining grating parameters | ||
N=500; % Matrix size | ||
P=100; % Grating period | ||
A1=ones(P,N); % Size of fundamental building block of grating | ||
g=8; % Number of phase levels | ||
delphase= 2*pi/g; %Phase step size | ||
|
||
% Constructing one n-level section of the phase grating | ||
sub =round(P/g)-1; | ||
for count = 1:g; | ||
A1((count -1)*sub+1:count*sub,:)=exp(1i*(count-1)*delphase); | ||
end | ||
|
||
%Constructing the full grating | ||
A2=repmat(A1,N/P,1); | ||
|
||
%Observation of the diffraction pattern | ||
E=fftshift(fft2(A2)); %fftshift to re-order the terms to the natural order | ||
IN=(abs(E)/(N*N)).*(abs(E)/(N*N)); %Normalize the intensity values | ||
figure(1) | ||
colormap(gray); | ||
imagesc(angle(A2)) | ||
figure(2) | ||
colormap(gray); | ||
imagesc(IN); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
% 4-level axicon | ||
clear; %Clear all memory | ||
|
||
%Defining axicon parameters | ||
N=480; % Matrix size | ||
A=zeros(N,N); | ||
P=40; % Grating period | ||
g=4; %Define the number of phase levels in each period | ||
w=P/g; %Define the width of each phase levels | ||
delphase=2*pi/g; | ||
%Constructing the 8-level axicon | ||
x=1:N; | ||
y=1:N; | ||
[X,Y]=meshgrid(x,y); | ||
r=sqrt((X-N/2).*(X-N/2)+(Y-N/2).*(Y-N/2)); | ||
for n=1:g; | ||
A(rem(r+(n-2)*w,P)<P/g)=exp(1i*(w-(n))*delphase); | ||
end | ||
|
||
A(r>N/2)=0; | ||
|
||
|
||
%Observation of the diffraction pattern | ||
E=fftshift(fft2(A)); %fftshift to re-order the terms to the natural order | ||
I=abs(E).*abs(E); | ||
figure(1) | ||
colormap(gray); | ||
imagesc(angle(A)) | ||
figure(2) | ||
colormap(gray); | ||
imagesc(I); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
%% 4-level axicon | ||
clear; %Clear all memory | ||
|
||
%Defining axicon parameters | ||
N=480; % Matrix size | ||
A=zeros(N,N); | ||
P=80; % Grating period | ||
g=16; %Define the number of phase levels in each period | ||
w=P/g; %Define the width of each phase levels | ||
delphase=2*pi/g; | ||
%Constructing the 8-level axicon | ||
x=1:N; | ||
y=1:N; | ||
[X,Y]=meshgrid(x,y); | ||
r=sqrt((X-N/2).*(X-N/2)+(Y-N/2).*(Y-N/2)); | ||
for n=1:g; | ||
A(rem(r+(n-2)*w,P)<P/g)=exp(1i*(w-(n))*delphase); | ||
end | ||
|
||
A(r>N/2)=0; | ||
|
||
|
||
%Observation of the diffraction pattern | ||
E=fftshift(fft2(A)); %fftshift to re-order the terms to the natural order | ||
I=abs(E).*abs(E); | ||
figure(1) | ||
colormap(gray); | ||
imagesc(angle(A)) | ||
figure(2) | ||
colormap(gray); | ||
imagesc(I); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
%Multifunctional DOE – Blazed FZP and 2-d grating | ||
clear;%Clear all memory | ||
|
||
%Define grating and FZP parameters | ||
N=500;%Define Matrix size | ||
f=10000; | ||
lambda=0.632; | ||
Pr=50; | ||
Px=25; | ||
Py=25; | ||
FFr=0.5; | ||
FFy=0.5; | ||
FFx=0.5; | ||
A1=zeros(N,N);%Define the matrices assigning ones to all pixels | ||
A2=zeros(N,N); | ||
A3=zeros(N,N); | ||
|
||
%Grating and Axicon construction and multiplexing | ||
x=1:N; | ||
y=1:N; | ||
[X,Y]=meshgrid(x,y); | ||
r=sqrt((X-N/2).*(X-N/2)+(Y-N/2).*(Y-N/2)); | ||
A1(rem(r,Pr)<Pr*FFr)=1; | ||
A2(rem(Y,Py)<Py*FFy)=1; | ||
A3(rem(X,Px)<Px*FFx)=1; | ||
A4=pi*xor(A1,xor(A2,A3)); | ||
B=exp(1i*A4); | ||
B(r>150)=0; | ||
|
||
%Observation of diffraction pattern | ||
C=fftshift(fft2(B)); | ||
D=abs(C).*abs(C); | ||
colormap(gray) | ||
imagesc(D) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
%Multifunctional DOE – Blazed FZP and 2-d grating | ||
clear;%Clear all memory | ||
|
||
%Define grating and FZP parameters | ||
N=500;%Define Matrix size | ||
f=10000; | ||
lambda=0.632; | ||
Pr=50; | ||
Px=25; | ||
Py=25; | ||
FFr=0.5; | ||
FFy=0.5; | ||
FFx=0.5; | ||
A1=zeros(N,N);%Define the matrices assigning ones to all pixels | ||
A2=zeros(N,N); | ||
A3=zeros(N,N); | ||
|
||
%Grating and Axicon construction and multiplexing | ||
x=1:N; | ||
y=1:N; | ||
[X,Y]=meshgrid(x,y); | ||
r=sqrt((X-N/2).*(X-N/2)+(Y-N/2).*(Y-N/2)); | ||
A1=(rem(r,Pr))*(2*pi)/Pr; | ||
A2(rem(Y,Py)<Py*FFy)=1; | ||
A3(rem(X,Px)<Px*FFx)=1; | ||
A4=pi*xor(A2,A3); | ||
A=rem(A1+A4,2*pi); | ||
B=exp(1i*A); | ||
B(r>150)=0; | ||
|
||
%Observation of diffraction pattern | ||
C=fftshift(fft2(B)); | ||
D=abs(C).*abs(C); | ||
colormap(gray) | ||
imagesc(D) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
%Multifunctional DOE – Blazed FZP and 2-d grating | ||
clear;%Clear all memory | ||
|
||
%Define grating and FZP parameters | ||
N=500;%Define Matrix size | ||
f=10000; | ||
lambda=0.632; | ||
P=100; | ||
FFy=0.5; | ||
FFx=0.5; | ||
A1=zeros(N,N);%Define the matrices assigning ones to all pixels | ||
A2=zeros(N,N); | ||
A3=zeros(N,N); | ||
|
||
%Grating and FZP construction and multiplexing | ||
x=1:N; | ||
y=1:N; | ||
[X,Y]=meshgrid(x,y); | ||
r=sqrt((X-N/2).*(X-N/2)+(Y-N/2).*(Y-N/2)); | ||
A1=(f-sqrt(f*f+r.*r))*(2*pi)/(0.632); | ||
A1=rem(A1,2*pi); | ||
A2(rem(Y,P)<P*FFy)=pi; | ||
A3(rem(X,P)<P*FFx)=pi; | ||
A4=pi*xor(A2,A3); | ||
A=rem(A1+A4,2*pi); | ||
B=exp(1i*A); | ||
|
||
%Observation of DOE | ||
colormap(gray) | ||
imagesc(angle(B)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
%Grating+Axicon | ||
%Define parameters | ||
N=500;%%Define size of the matrix | ||
Angle1=1;%Define angle of axicon | ||
Angle2=1;%Define angle of grating | ||
V=0.5;%%Visibility controller | ||
lambda=0.632*1e-6;%Define wavelength | ||
|
||
%Create sampled space | ||
del=1*1e-6;%sampling | ||
x=-N/2:N/2-1; | ||
y=-N/2:N/2-1; | ||
[X,Y]=meshgrid(x*del,y*del); | ||
r=sqrt(X.^2+Y.^2); | ||
A=V*exp(1i*(r/lambda)*tand(Angle1)*2*pi); | ||
B=V*exp(1i*(Y/lambda)*tand(Angle2)*2*pi); | ||
D=A+B;%Interference of the object and reference wave | ||
|
||
%%Intensity profile | ||
I=abs(D).*abs(D); | ||
I1=im2bw(I); | ||
Grating_axicon=exp(1i*pi*I1); | ||
Grating_axicon(r>100)=0; | ||
E=fftshift(fft2(Grating_axicon)); | ||
I2=(abs(E).*abs(E)); | ||
colormap(gray);%%Display result | ||
imagesc(I2); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
%Forked grating | ||
%Define parameters | ||
N=500;%%Define size of the matrix | ||
Angle=1;%Define angle of the second plane wave | ||
V=0.5;%%Visibility controller | ||
lambda=0.632*1e-6;%Define wavelength | ||
L=5; | ||
|
||
%Create sampled space | ||
del=1*1e-6;%sampling | ||
x=-N/2:N/2-1; | ||
y=-N/2:N/2-1; | ||
[X,Y]=meshgrid(x*del,y*del); | ||
r=sqrt(X.^2+Y.^2); | ||
A=V*exp(1i*L*(atan2(Y,X))); | ||
B=V*exp(1i*(r/lambda)*tand(Angle)*2*pi); | ||
D=A+B;%Interference of the object and reference wave | ||
|
||
%%Intensity profile | ||
I=abs(D).*abs(D); | ||
I1=im2bw(I); | ||
Heli_axicon=exp(1i*pi*I1); | ||
Heli_axicon(r>100*1e-6)=0; | ||
E=fftshift(fft2(Heli_axicon)); | ||
I2=(abs(E).*abs(E)); | ||
colormap(gray);%%Display result | ||
imagesc(I2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
%%program to calculate back transverse focal aberration | ||
u=5000; | ||
v=30000; | ||
l=0.632; | ||
na=1; | ||
ng=1.5; | ||
for n=1:1000; | ||
a(n)=n*n*l*l+2*n*l*(u+v)+2*u*v; | ||
r(n)=sqrt(((a(n)*a(n))-4*u*u*v*v)/(4*(a(n)+u*u+v*v))); | ||
if r(n)>=500 && r(n)<=700; | ||
t=3000; | ||
else | ||
t=1000; | ||
end | ||
theta(n)=atan(r(n)/u); | ||
rr(n)=r(n)*((u-t)/u); | ||
r1(n)=rr(n)+t*tan(asin(na/ng*(sin(atan(r(n)/u))))); | ||
u1(n)=u*(r1(n)/r(n)); | ||
a1(n)=n*n*l*l+2*n*l*(u1(n)+v)+2*u1(n)*v; | ||
rr(n)=sqrt(((a1(n)*a1(n))-4*u1(n)*u1(n)*v*v)/(4*(a1(n)+u1(n)*u1(n)+v*v))); | ||
b(n)=(4*n*n*l*l+8*n*l*u1(n)-4*rr(n)*rr(n)); | ||
c(n)=(4*n^3*l^3+12*n*n*l*l*u1(n)+8*n*l*u1(n)*u1(n)-8*rr(n)*rr(n)*n*l-8*rr(n)*rr(n)*u1(n)); | ||
d(n)=(n^4*l^4+4*n*n*l*l*u1(n)*u1(n)+4*n^3*l^3*u1(n)-4*rr(n)*rr(n)*u1(n)*u1(n)-4*rr(n)*rr(n)*n*n*l*l-8*rr(n)*rr(n)*n*l*u1(n)); | ||
v2(n)=(-c(n)+sqrt(c(n)*c(n)-4*b(n)*d(n)))/(2*b(n)); | ||
the1(n)=atan(rr(n)/v2(n)); | ||
end | ||
plot(the1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
%%program to calculate back transverse focal aberration | ||
u=5000; | ||
v=30000; | ||
l=0.632; | ||
na=1; | ||
ng=1.5; | ||
for n=1:1000; | ||
a(n)=n*n*l*l+2*n*l*(u+v)+2*u*v; | ||
r(n)=sqrt(((a(n)*a(n))-4*u*u*v*v)/(4*(a(n)+u*u+v*v))); | ||
t(n)=1000+(r(n)/1000)*1000; | ||
theta(n)=atan(r(n)/u); | ||
rr(n)=r(n)*((u-t(n))/u); | ||
r1(n)=rr(n)+t(n)*tan(asin(na/ng*(sin(atan(r(n)/u))))); | ||
u1(n)=u*(r1(n)/r(n)); | ||
a1(n)=n*n*l*l+2*n*l*(u1(n)+v)+2*u1(n)*v; | ||
rr(n)=sqrt(((a1(n)*a1(n))-4*u1(n)*u1(n)*v*v)/(4*(a1(n)+u1(n)*u1(n)+v*v))); | ||
b(n)=(4*n*n*l*l+8*n*l*u1(n)-4*r(n)*r(n)); | ||
c(n)=(4*n^3*l^3+12*n*n*l*l*u1(n)+8*n*l*u1(n)*u1(n)-8*r(n)*r(n)*n*l-8*r(n)*r(n)*u1(n)); | ||
d(n)=(n^4*l^4+4*n*n*l*l*u1(n)*u1(n)+4*n^3*l^3*u1(n)-4*r(n)*r(n)*u1(n)*u1(n)-4*r(n)*r(n)*n*n*l*l-8*r(n)*r(n)*n*l*u1(n)); | ||
v2(n)=(-c(n)+sqrt(c(n)*c(n)-4*b(n)*d(n)))/(2*b(n)); | ||
the1(n)=atan(rr(n)/v2(n)); | ||
end | ||
plot(rr) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
%Spiral phase plate + axicon | ||
%Clear all memory | ||
clear; | ||
%Define Matrix size | ||
N=500; | ||
%Define Matrices by assigning 0 or 1 to all elements | ||
A1=zeros(N,N); | ||
A2=ones(N,N); | ||
r=zeros(N,N); | ||
%Define focal length and wavelength (in micrometers) | ||
P=10; | ||
M=(N/P)*0.5; | ||
L=10; | ||
r1=zeros(M,M); | ||
%Calculate the widths of the grating lines | ||
for n=1:M; | ||
r1(n)=n*P; | ||
end | ||
%Scan element by element using two for loops | ||
%Define pixels within grating lines with pi | ||
for n=1:2:M; | ||
for p=1:N; | ||
for q=1:N; | ||
r(p,q)=sqrt((p-N/2)*(p-N/2)+(q-N/2)*(q-N/2)); | ||
if r(p,q)<100; | ||
if r(p,q) > r1(n) && r(p,q) < r1(n+1); | ||
A1(p,q)=exp(1i*L*(atan2((q-N/2),(p-N/2)))); | ||
end | ||
end | ||
end | ||
end | ||
end | ||
%Observing the diffraction pattern | ||
E=fftshift(fft2(A1)); | ||
I=abs(E).*abs(E); | ||
colormap(gray) | ||
imagesc(I) |
Oops, something went wrong.