LENS3 Demonstrates various lens equations for Chapter 3
SYNTAX: lens3;
by Chuck DiMarzio Northesastern University December 2008
!! 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
Principal planes vs thickness for a simple lens in air
ax=5; % range of variable to plot f1=10;n=1.5; % Focal length and index of refraction z12=(0:0.01:1)*ax; % Thickness of the lens p1=1/f1/2; % Optical power of the first surface r1inv=-p1/(n-1); % curvature of first surface p2=1/f1-p1; % Power of second surface to maintain sum of powers = 1/f r2inv=-p2/(n-1); % curvature of second surface r1=1/r1inv; % Radii of curvature r2=1/r2inv; p=p1+p2-z12/n*p1*p2; % Actual power of the lens, not quite p1+p2 f=1./p; % Focal length, for plotting h=-p2/n./p.*z12; % Locations of front and back principal planes hprime=-p1/n./p.*z12; vz=-z12/2; % Absolute location of front vertex (trailing z denotes absolute) hz=vz-h; % Absolute location of front principal plane vzp=z12/2; % trailing p denotes "prime" for back vzp is absolute location % of back vertex hzp=vzp+hprime; % back principal plane fz=--hz-f; % Absolute locations of focal points fzp=hzp+f; fig1 = figure(1); plot(vz,z12,'-',hz,z12,'--',vzp,z12,'-',hzp,z12,'--',... fz,z12,'-.',fzp,z12,'-.'); xlabel('Locations');ylabel('z_{12}, Lens Thickness'); grid on;

Principal planes vs. bending n=1.5
z12=3; % Keep thickness fixed ax=1/4;f1=10;n=1.5; % Set up an 1/r1 axis r1inv=ax*(-1:0.1:1); % Curvature of first surface This is 1/r1 p1=(n-1)*r1inv; % Power of the first surface p2=1/f1-p1; % Power of the second surface to maintain constant p1+p2 r2inv=-p2/(n-1); % Curvature of second surface p=p1+p2+z12/n*p1.*p2; % Actual power of the lens f=1./p; % Focal length, for plotting h=-p2/n./p.*z12; % Principal planes hprime=-p1/n./p.*z12; vz=-z12/2*ones(size(r1inv)); % Absolute vertices and principal planes hz=vz-h; vzp=z12/2*ones(size(r1inv)); hzp=vzp+hprime; fz=hz-f; % Absolute focal planes fzp=hzp+f; fig2 = figure(2); % Plot absolute locations vs curvature of first surface plot(vz,r1inv,'-',hz,r1inv,'--',vzp,r1inv,'-',hzp,r1inv,'--',... fz,r1inv,'-.',fzp,r1inv,'-.'); elk=axis; axis([2*f1*[-1,1],elk(3:4)]); ha=gca; moose=get(ha,'YTickLabel'); % ticks are radius of curvature instead of % curvature itself. set(ha,'YTickLabel',num2str(1./str2num(moose),2)); xlabel('Locations'); ylabel('r_1, Radius of Curvature'); grid on; hold on; % The rest of this cell is just cosmetic additions to the plot % Draw pictures of the lenses pt1=find(abs(r1inv+r2inv)==min(abs(r1inv+r2inv))); % Biconvex r1p=1/r1inv(pt1); r2p=1/r2inv(pt1); elk=axis; xax=elk(2)-elk(1); % length of x axis yax=elk(4)-elk(3); % length of y axis xplot=elk(1)+xax*0.05; % x location to place the lens pictures yb=min(abs([r1p,r2p]))/2; % semidiameter of the lens: keep for other shapes [x,y,yedge]=lensshape(r1p,r2p,yb,0.5); % Generate the picture plot(xplot+x*xax/20/yedge,1/r1p+y*yax/20/yedge); % Draw the picture axis(elk); % Fix any damage to the axis pt2=find(abs(r1inv)==min(abs(r1inv))); % draw the planoconvex r1p=1/r1inv(pt2); r2p=1/r2inv(pt2); elk=axis; xax=elk(2)-elk(1); % length of x axis yax=elk(4)-elk(3); % length of y axis xplot=elk(1)+xax*0.05; [x,y,yedge]=lensshape(r1p,r2p,yb,0.5); plot(xplot+x*xax/20/yedge,1/r1p+y*yax/20/yedge); axis(elk); pt3=find(abs(r2inv)==min(abs(r2inv))); % draw the convexplano r1p=1/r1inv(pt3); r2p=1/r2inv(pt3); elk=axis; xax=elk(2)-elk(1); % length of x axis yax=elk(4)-elk(3); % length of y axis xplot=elk(1)+xax*0.05; [x,y,yedge]=lensshape(r1p,r2p,yb,0.5); plot(xplot+x*xax/20/yedge,1/r1p+y*yax/20/yedge); axis(elk); for nn=1:3; pt4=pt3+nn*(pt3-pt1); % draw an examle Meniscus if(pt4>0 && pt4 <length(r1inv)); r1p=1/r1inv(pt4); r2p=1/r2inv(pt4); elk=axis; xax=elk(2)-elk(1); % length of x axis yax=elk(4)-elk(3); % length of y axis xplot=elk(1)+xax*0.05; [x,y,yedge]=lensshape(r1p,r2p,yb,0.5); plot(xplot+x*xax/20/yedge,1/r1p+y*yax/20/yedge); axis(elk); end; end; for nn=1:3; pt5=pt2+nn*(pt2-pt1); % draw example Meniscus the other way if(pt5>0 && pt5 <length(r1inv)); r1p=1/r1inv(pt5); r2p=1/r2inv(pt5); elk=axis; xax=elk(2)-elk(1); % length of x axis yax=elk(4)-elk(3); % length of y axis xplot=elk(1)+xax*0.05; [x,y,yedge]=lensshape(r1p,r2p,yb,0.5); plot(xplot+x*xax/20/yedge,1/r1p+y*yax/20/yedge); axis(elk); end; end;

Principal planes vs. bending n=4
z12=2; ax=1/10;f1=10;n=4; % Set up an 1/r1 axis r1inv=ax*(-1:0.1:1); %f This is 1/r1 p1=(n-1)*r1inv; % See comments above where n=1.5 p2=1/f1-p1; r2inv=-p2/(n-1); p=p1+p2+z12/n*p1.*p2; f=1./p; % Focal length, for plotting h=-p2/n./p.*z12; hprime=-p1/n./p.*z12; vz=-z12/2*ones(size(r1inv)); hz=vz-h; vzp=z12/2*ones(size(r1inv)); hzp=vzp+hprime; fz=hz-f; fzp=hzp+f; fig3 = figure(3); plot(vz,r1inv,'-',hz,r1inv,'--',vzp,r1inv,'-',hzp,r1inv,'--',... fz,r1inv,'-.',fzp,r1inv,'-.'); elk=axis; axis([2*f1*[-1,1],elk(3:4)]); h=gca; moose=get(h,'YTickLabel'); set(h,'YTickLabel',num2str(1./str2num(moose),2)); xlabel('Locations'); ylabel('r_1, Radius of Curvature'); grid on; hold on; pt1=find(abs(r1inv+r2inv)==min(abs(r1inv+r2inv))); % Biconvex r1p=1/r1inv(pt1); r2p=1/r2inv(pt1); elk=axis; xax=elk(2)-elk(1); % length of x axis yax=elk(4)-elk(3); % length of y axis indent=0.2; % For positioning the lens marker in x dindent=0.04; xplot=elk(1)+xax*indent; yb=min(abs([r1p,r2p]))/2; % semidiameter of the lens: keep for other shapes [x,y,yedge]=lensshape(r1p,r2p,yb,0.5); plot(xplot+x*xax/20/yedge,1/r1p+y*yax/20/yedge); axis(elk); pt2=find(abs(r1inv)==min(abs(r1inv))); % planoconvex r1p=1/r1inv(pt2); r2p=1/r2inv(pt2); elk=axis; xax=elk(2)-elk(1); % length of x axis yax=elk(4)-elk(3); % length of y axis xplot=elk(1)+xax*(indent-dindent); [x,y,yedge]=lensshape(r1p,r2p,yb,0.5); plot(xplot+x*xax/20/yedge,1/r1p+y*yax/20/yedge); axis(elk); pt3=find(abs(r2inv)==min(abs(r2inv))); % convexplano r1p=1/r1inv(pt3); r2p=1/r2inv(pt3); elk=axis; xax=elk(2)-elk(1); % length of x axis yax=elk(4)-elk(3); % length of y axis xplot=elk(1)+xax*(indent-dindent); [x,y,yedge]=lensshape(r1p,r2p,yb,0.5); plot(xplot+x*xax/20/yedge,1/r1p+y*yax/20/yedge); axis(elk); for nn=1:3; pt4=pt3+nn*(pt3-pt1); % Meniscus if(pt4>0 && pt4 <length(r1inv)); r1p=1/r1inv(pt4); r2p=1/r2inv(pt4); elk=axis; xax=elk(2)-elk(1); % length of x axis yax=elk(4)-elk(3); % length of y axis xplot=elk(1)+xax*(indent-(nn+1)*dindent); [x,y,yedge]=lensshape(r1p,r2p,yb,0.5); plot(xplot+x*xax/20/yedge,1/r1p+y*yax/20/yedge); axis(elk); end; end; for nn=1:3; pt5=pt2+nn*(pt2-pt1); % Other Meniscus if(pt5>0 && pt5 <length(r1inv)); r1p=1/r1inv(pt5); r2p=1/r2inv(pt5); elk=axis; xax=elk(2)-elk(1); % length of x axis yax=elk(4)-elk(3); % length of y axis xplot=elk(1)+xax*(indent-(nn+1)*dindent); [x,y,yedge]=lensshape(r1p,r2p,yb,0.5); plot(xplot+x*xax/20/yedge,1/r1p+y*yax/20/yedge); axis(elk); end; end;
