Skip to content

Instantly share code, notes, and snippets.

@mpreciado
Last active October 24, 2018 09:31
Show Gist options
  • Save mpreciado/115637b0d557a4eb8b7a1a0723308119 to your computer and use it in GitHub Desktop.
Save mpreciado/115637b0d557a4eb8b7a1a0723308119 to your computer and use it in GitHub Desktop.
Compensating beam designed in Miguel A. Preciado, Kishan Dholakia, and Michael Mazilu, "Generation of attenuation-compensating Airy beams," Opt. Lett. 39, 4950-4953 (2014)
% compensating Airy beam in Air
% Author: Miguel A. Preciado @miguelSciLight
%
% See publication below for details:
% Miguel A. Preciado, Kishan Dholakia, and Michael Mazilu, "Generation of attenuation-compensating Airy beams," Opt. Lett. 39, 4950-4953 (2014)
%
%Please cite the paper above for reference.
%
% More info:
% https://sites.google.com/view/miguelscilight/resources
% https://www.researchgate.net/publication/284505770_Attenuation_compensating_Airy_beams_generated_by_using_a_digital_micro-mirror_device
%
close all;
clear all;
%refractive index (air).
nmedium=1;
%wavelength in vacuum
lambda0=532e-9;
%wavelength in medium
lambda=lambda0/nmedium;
%% boring bits
% N=684;
factor=1;
TAMX=factor*0.37e-2;
N=factor*684;
%%
% Spatial window
x=TAMX*(-N/2:N/2-1)/N;
%spatial frequency, acording to DFT rules.
vx=((1:length(x))-length(x)/2) / (max(x)-min(x));
%%
%%
fac1=1;
fac2=2;
Axmax=fac2*fac1*0.3*0.1e-2;
Atetamax=fac1*0.5*532e-9/21.6e-6;
teta=vx*lambda;
Avxmax=Atetamax/lambda;
%% This term introduce the amplitude modulation, leading to the compensating effect. Change 1.7 factor for other compensations.
SpectAmp=exp(1.7*vx/Avxmax);
%% Set the ammount of cubic phase introduced.
a=-Axmax/(Atetamax.^2);
% Apodized window, to avoid diffraction of sharp spectral edges that would distort the resulting beam otherwise.
WindowAiry=exp(-(vx.^8)/(2*((0.75*Avxmax)^8)));
% Spatial shift.
shift=0; %set z0
shiftPhase=exp(j*2*pi*vx*shift);
% Airy beam in frequency
F_airy_0=exp(j*2*pi*(a/3)*(lambda^2)*((vx).^3));
%range of distances for simmulation
zz=4e-2*(-1:0.025:1);
II=1;
for(z=zz)
diffraction=exp(j*pi*lambda*z*(vx.^2));
F_airy=F_airy_0.*SpectAmp.*WindowAiry.*shiftPhase.*diffraction;
f_airy(:,II)=fftshift((ifft(fftshift(F_airy))));
II=II+1;
end
imagesc(zz*1e3,x*1e3,abs(f_airy).^2);colormap hot;
xlabel('z [mm]');
ylabel('x [mm]');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment