Function to reproduce Fig. 6.10(b) Wavelength dependence of the LFIEF at several points on the sphere surface for a 50 nm radius silver sphere in water. This file is part of the SPlaC v1.0 package (copyright 2008) Check the README file for further information
0001 %%%%%%%%%%%%%%%%%%% 0002 % Computations 0003 %%%%%%%%%%%%%%%%%%% 0004 0005 global noCheckSum; 0006 noCheckSum=true; % no check for numerical problems (much faster) 0007 % noCheckSum=false; % to check for numerical problems with Mie 0008 0009 % N_{max} for Mie series 0010 nNmax=50; % same for all plots 0011 0012 % dielectric constant of outside medium (real positive) 0013 epsilonM=1.77; % water (same for all plots) 0014 0015 % wavelenght in nm 0016 %lambda=transpose(350:1:700); 0017 lambda=transpose(200:1:1000); 0018 % dielectric function of sphere material 0019 % vector column, same size as lambda [L x 1] 0020 epsilonIn=epsAg(lambda); % silver 0021 0022 % sphere radius in nm 0023 a=50; 0024 0025 % Solve problem using Mie theory 0026 stM=PweSolveSingleSphere(nNmax,a,lambda,epsilonM,epsilonIn,'noplot','coeff'); 0027 % all necessary results are in structure stM 0028 0029 % calculate field on the surface for exterior points 0030 % % points can be defined in spherical coordinates as follows 0031 % stPtA=struct('r',a,'theta',pi/2,'phi',0); 0032 % stPtBC=struct('r',a,'theta',pi/4,'phi',pi/2); 0033 % stPtAC=struct('r',a,'theta',pi/4,'phi',0); 0034 % stPtACp=struct('r',a,'theta',3*pi/4,'phi',0); 0035 0036 % Note that points can also be defined in Cartesian as follows: 0037 stPtA=struct('x',a,'y',0,'z',0); 0038 stPtBC=struct('x',0,'y',a/sqrt(2),'z',a/sqrt(2)); 0039 stPtAC=struct('x',a/sqrt(2),'y',0,'z',a/sqrt(2)); 0040 stPtACp=struct('x',a/sqrt(2),'y',0,'z',-a/sqrt(2)); 0041 0042 % Note that the plot for ptBC in incorrect in the book, it 0043 % instead corresponds to point ABC defined as 0044 % stPtABC=struct('r',a,'theta',pi/4,'phi',pi/4); 0045 0046 % outside points, stM already contains fields cn1 and dn1 0047 stPtArray=[stPtA,stPtBC,stPtAC,stPtACp]; 0048 stEptsOut=PweEpts(lambda,epsilonM,stM,stPtArray,'Outside'); 0049 0050 %%%%%%%%%%%%%%%%%%% 0051 % Drawing 0052 %%%%%%%%%%%%%%%%%%% 0053 0054 % create, position, and resize figure 0055 scrsz = get(0,'ScreenSize'); % scrsz(4) contains screen height 0056 figAspectRatio=1.5; 0057 figWidth=3/4*scrsz(3); 0058 figure('Name','Fig. 6.10(b)', ... 0059 'Position',[(scrsz(3)-figWidth)/2 scrsz(4)-150-figWidth/figAspectRatio figWidth figWidth/figAspectRatio]); 0060 0061 0062 % plot results 0063 hg=semilogy(lambda,stEptsOut(1).MLoc,'-', ... 0064 lambda,stEptsOut(2).MLoc,':', ... 0065 lambda,stEptsOut(3).MLoc,'-', ... 0066 lambda,stEptsOut(4).MLoc,'--'); 0067 set(hg(1),'LineWidth',1.5); 0068 axis([350 700 2 300]); 0069 title('Silver sphere (a=50nm) in water'); 0070 legend({'A','BC','AC','AC'''}); 0071 xlabel('Wavelength [nm]'); 0072 ylabel('M_{Loc}'); 0073 end