Home > SPlaC v1_0 > BookFigures > MakeFig6_9.m

MakeFig6_9

PURPOSE ^

Function to reproduce Fig. 6.9

SYNOPSIS ^

function MakeFig6_9()

DESCRIPTION ^

 Function to reproduce Fig. 6.9
 Spatial distribution of the local field,
 characterized by the enhancement factor log10(MLoc) (left),
 and the proportion of the normal component |Eperp|2/|ELoc|2 (right),
 both computed at the main dipolar LSP resonance: (top) for a 10 nm radius silver sphere in water
 at 392 nm, and (bottom) for a 50 nm radius silver sphere in water at 492 nm.

 This file is part of the SPlaC v1.0 package (copyright 2008)
 Check the README file for further information

EXAMPLE OF OUTPUT ^

Example figure output

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 global noCheckSum;
0002 noCheckSum=true; % no check for numerical problems (much faster)
0003 % noCheckSum=false; % to check for numerical problems with Mie
0004 
0005 % N_{max} for Mie series
0006 nNmax=50; % same for all plots
0007 
0008 % dielectric constant of outside medium (real positive)
0009 epsilonM=1.77; % water (same for all plots)
0010 
0011 
0012 
0013 % create, position, and resize figure
0014 scrsz = get(0,'ScreenSize'); % scrsz(4) contains screen height
0015 figAspectRatio=1;
0016 figHeight=scrsz(4)-150;
0017 figWidth=figAspectRatio*figHeight;
0018 figure('Name','Fig. 6.9', ...
0019     'Position',[(scrsz(3)-figWidth)/2 50 figWidth figHeight]);
0020 
0021 nNbTheta=31; % = T
0022 theta=transpose(linspace(0,pi,nNbTheta)); % col [T x 1]
0023 nNbPhi=nNbTheta;
0024 phi=linspace(-pi,pi,nNbPhi); % row [1 x F]
0025 % point coordinates on sphere, matrices [T x F]
0026 xs=sin(theta) * cos(phi); 
0027 ys=sin(theta) * sin(phi); 
0028 zs=repmat(cos(theta),1,nNbPhi); 
0029 
0030 % radii (nm)
0031 aArray=[10,50];
0032 % wavelengths (nm)
0033 lambdaArray=[392, 492]; 
0034 
0035 sTitle={'Silver sphere in water - a=10 nm - \lambda=392 nm', ...
0036     'Silver sphere in water - a=50nm - \lambda=492 nm'};
0037 
0038 % loop through each of the two plots to create
0039 for nn=1:2
0040     lambda=lambdaArray(nn); 
0041     % dielectric function of sphere material
0042     % vector column, same size as lambda [1 x 1] here
0043     epsilonIn=epsAg(lambda); % silver
0044     
0045     % sphere radius in nm
0046     a=aArray(nn);
0047 
0048     % Solve problem using Mie theory
0049     stM=PweSolveSingleSphere(nNmax,a,lambda,epsilonM,epsilonIn,'noplot','coeff');
0050     % all necessary results are in structure stM
0051     % stM contains fields cn1 and dn1
0052     % calculate field for all points on the surface (just outside)
0053     stEsurf=PweEsurf(lambda,epsilonM,stM,a,nNbTheta,'Outside');
0054     
0055     % theta dependence
0056     Ecr2=transpose(abs(stEsurf.Ecr).^2); % col [T x 1]
0057     Ec2=Ecr2+transpose(abs(stEsurf.Ect).^2); % col [T x 1]
0058     Es2=transpose(abs(stEsurf.Esf).^2); % col [T x 1]
0059 
0060     % phi-and-theta dependence
0061     % these are matrices [T x F]
0062     MLoc=Ec2 * (cos(phi).^2) + Es2 * (sin(phi).^2); 
0063     MLocPerp=Ecr2 * (cos(phi).^2);
0064     
0065     % plot results
0066     
0067     hpl1=subplot(2,2,2*nn-1);
0068     set(hpl1,'Outerposition',[0,0.5*(2-nn),0.5,0.5]);
0069     % main surface plot
0070     surf(xs,ys,zs,log10(MLoc));
0071     axis tight; axis equal; axis off;
0072     colormap gray; colorbar('eastOutside','fontsize',8);
0073     set(hpl1,'CameraViewAngle',8.5);
0074     hold on;
0075     line([-1.6;1.6], [0;0],[0;0],'LineStyle','--','Color','k');
0076     line([0;0],[-1.8;1.8], [0;0],'LineStyle','--','Color','k');
0077     line([0;0],[0;0],[-1.4;1.4], 'LineStyle','--','Color','k');
0078     quiver3(-1.7,0,0,0.5,0,0,'k');
0079     text(-1.55,-0.1,-0.07,'\bf E_0');
0080     quiver3(-1.7,0,0,0,0,0.5,'k');
0081     text(-1.9,0,0.3,'\bf k');
0082     text(-0.9,0,1.85,'\bf log_{10}( M_{Loc}=|E_{Loc}|^2/|E_{Inc}|^2 )');
0083     ht=title(sTitle{nn});
0084     set(ht,'Position',get(ht,'Position')+[1.4 -1.1 0]);
0085     hold off;
0086     
0087     hpl2=subplot(2,2,2*nn);
0088     set(hpl2,'Outerposition',[0.5,0.5*(2-nn),0.5,0.5])
0089     % main surface plot
0090     surf(xs,ys,zs,MLocPerp./MLoc);
0091     axis tight; axis equal;axis off;
0092     colormap gray; colorbar('eastOutside','fontsize',8);
0093     set(hpl2,'CameraViewAngle',8.5);
0094     hold on;
0095     line([-1.6;1.6], [0;0],[0;0],'LineStyle','--','Color','k');
0096     line([0;0],[-1.8;1.8], [0;0],'LineStyle','--','Color','k');
0097     line([0;0],[0;0],[-1.4;1.4], 'LineStyle','--','Color','k');
0098     quiver3(-1.7,0,0,0.5,0,0,'k');
0099     text(-1.55,-0.1,-0.07,'\bf E_0');
0100     quiver3(-1.7,0,0,0,0,0.5,'k');
0101     text(-1.9,0,0.3,'\bf k');
0102     text(-0.6,0,1.85,'\bf |E^{Perp}_{Loc}|^2/|E_{Loc}|^2');
0103     hold off;
0104 end

This web page is part of the SPlaC package © 2008. Contact: Eric Le Ru
Generated on Wed 03-Dec-2008 11:10:14 by m2html © 2003 (adapted)