GAUSSIAN9 Generates a Gaussian wave image and annotations

by Chuck DiMarzio Northeastern University July 2009

!! This file may be copied, used, or modified for educational and
!! research purposes provided that this header information is not
!! removed or altered, and provided that the book is cited in
!! publications, as DiMarzio, Charles A., Optics for Engineers,
!! CRC Press, Boca Raton, FL, 2011.
!! http://www.crcpress.com
!! Other distribution is prohibited without permission.

Contents

Start

xaxis=[(-10:0.02:10)];
zaxis=[(-10:0.02:10)];
lambda=1;
k=2*pi/lambda;
w0=0.75;
b=pi*w0^2/lambda;
[x,z]=meshgrid(xaxis,zaxis);
w=w0.*sqrt(1+(z/b).^2);
% rho=z+b^2./(z);  Avoid divide by zero by using rhoinv instead
rhoinv=z./(z.^2+b^2);
psi=atan(z/b);
u=sqrt(2/pi./w.^2).*exp(-(x./w).^2).*...
  exp(1i*(x.^2)./lambda.*rhoinv).*...
  exp(1i*k*z).*exp(1i*psi);


% Generate a circle (spherical wavefront) for comparison
zshow=2*b;
a=(0:0.001:1)*2*pi;
circlex=zshow*cos(a);circlez=zshow*sin(a);

% Generate curved wavefront at z=5;
rhoshow=zshow+b^2./zshow;
a=(-60:60)*pi/180;
rhocurvex=rhoshow*sin(a);rhocurvez=zshow-rhoshow+rhoshow*cos(a);

% Generate beam boundaries
wplot=w0*sqrt(1+z.^2/b^2);
wshow=w0*sqrt(1+zshow^2/b^2);
% Color plot

fig4=figure;imagesc(xaxis,zaxis,imag(u));axis image;
moose=caxis;caxis(max(abs(moose))*[-1,1]);
colorbar;
hold on;
plot(circlex,circlez,'w-',rhocurvex,rhocurvez,'k--');
plot(-wplot,zaxis,'w-.',wplot,zaxis,'w-.',...
     -wshow,zshow,'kd',wshow,zshow,'kd');
hold off;

% Gray plot

fig5=figure;imagesc(xaxis,zaxis,imag(u));axis image;
moose=caxis;caxis(max(abs(moose))*[-1,1]);
colormap(flipud(gray));colorbar;
hold on;
plot(circlex,circlez,'w-',rhocurvex,rhocurvez,'k--');
plot(-wplot,zaxis,'w-.',wplot,zaxis,'w-.',...
     -wshow,zshow,'kd',wshow,zshow,'kd');
hold off;

% Laser cavity with flat front mirror
zfront=0;wmax=w0*1.5;  %  This variable is computed here in case it is needed
zback=-6;rhoback=zback+b^2/zback; % Same with this one.
amax=atan(1.5*lambda/pi/w0);
a=amax*[-1:0.05:1];
rhocurvex=rhoback*sin(a);rhocurvez=zback-rhoback+rhoback*cos(a);
fig8=figure;imagesc(xaxis,zaxis,imag(u));axis image;
moose=caxis;caxis(max(abs(moose))*[-1,1]);
colormap(flipud(gray));colorbar;
hold on;
plot(-wplot,zaxis,'w-.',wplot,zaxis,'w-.',...
     wmax*[-1,1],[0,0],'w-',rhocurvex,rhocurvez,'w-');

% Laser cavity with flat back mirror
zback=0;wmax=w0*1.5;
zfront=6;rhofront=zfront+b^2/zfront;
amax=atan(1.5*lambda/pi/w0);
a=amax*[-1:0.05:1];
rhocurvex=rhofront*sin(a);rhocurvez=zfront-rhofront+rhofront*cos(a);
fig9=figure;imagesc(xaxis,zaxis,imag(u));axis image;
moose=caxis;caxis(max(abs(moose))*[-1,1]);
colormap(flipud(gray));colorbar;
hold on;
plot(-wplot,zaxis,'w-.',wplot,zaxis,'w-.',...
     wmax*[-1,1],[0,0],'w-',rhocurvex,rhocurvez,'w-');

% Laser cavity with two concave mirrors
zback=-3;rhoback=zback+b^2/zback;
zfront=3;rhofront=zfront+b^2/zfront;
amax=atan(1.5*lambda/pi/w0);
a=amax*[-1:0.05:1];
rhocurvebx=rhoback*sin(a);rhocurvebz=zback-rhoback+rhoback*cos(a);
rhocurvefx=rhofront*sin(a);rhocurvefz=zfront-rhofront+rhofront*cos(a);
fig10=figure;imagesc(xaxis,zaxis,imag(u));axis image;
moose=caxis;caxis(max(abs(moose))*[-1,1]);
colormap(flipud(gray));colorbar;
hold on;
plot(-wplot,zaxis,'w-.',wplot,zaxis,'w-.',...
     rhocurvefx,rhocurvefz,'w-',rhocurvebx,rhocurvebz,'w-');

% Laser cavity with two concave mirrors
zback=-9;rhoback=zback+b^2/zback;
zfront=-3;rhofront=zfront+b^2/zfront;
amax=atan(1.5*lambda/pi/w0);
a=amax*[-1:0.05:1];
rhocurvebx=rhoback*sin(a);rhocurvebz=zback-rhoback+rhoback*cos(a);
rhocurvefx=rhofront*sin(a);rhocurvefz=zfront-rhofront+rhofront*cos(a);
fig11=figure;imagesc(xaxis,zaxis,imag(u));axis image;
moose=caxis;caxis(max(abs(moose))*[-1,1]);
colormap(flipud(gray));colorbar;
hold on;
plot(-wplot,zaxis,'w-.',wplot,zaxis,'w-.',...
     rhocurvefx,rhocurvefz,'w-',rhocurvebx,rhocurvebz,'w-');