Calculates several properties of the field on a spherical surface at r=r0 for PWE. Parameters: - stM: structure with results of the Mie computation can be obtained by calling PweSolveSingleSphere or MulPweSolveMultiSphere with sCoeff='coeff' - r0: scalar [1 x 1] non-zero distance from origin (in nm) - nNbTheta: integer scalar number of theta points used for computations - stPinTaun: structure (optional) with functions of theta pi_n and tau_n if omitted, then the functions are computed from scrath it is faster to pass this structure as argument if these functions have already been calculated Returns: structure stEsurf (see PweEsurf for details) This file is part of the SPlaC v1.0 package (copyright 2008) Check the README file for further information
0001 % get theta dependence if not provided 0002 if nargin < 4 0003 theta=linspace(0,pi,nNbTheta); % row [1 x T] 0004 stPinTaun=PwePinTaun(stM.nNmax,transpose(theta)); % fields are [T x nNmax] 0005 end 0006 0007 0008 if ~isfield(stM,'nK') % then stM corresponds to a single sphere 0009 % results depend on whether surface is inside or outside 0010 if (r0<0.99999*stM.a) % note that if r0=a, properties are computed outside the sphere 0011 stAbcdn1.an1=stM.alphan1; 0012 stAbcdn1.bn1=stM.betan1; 0013 stEsurf=PweEsurf(stM.lambda,stM.epsilonIn,stAbcdn1,r0,nNbTheta,'Inside',stPinTaun); 0014 else 0015 % stM already contains fields cn1 and dn1 0016 stEsurf=PweEsurf(stM.lambda,stM.epsilonM,stM,r0,nNbTheta,'Outside',stPinTaun); 0017 end 0018 else % then stM corresponds to a spherical multilayer 0019 % find layer where r0 is located 0020 nK=stM.nK; 0021 kk=nK; 0022 while ((kk>0) && (r0<0.99999*stM.Ca{kk})) % note that if r0=Ca{kk}, properties are computed just outside 0023 kk=kk-1; 0024 end 0025 % r0 has been located in region kk 0026 % extract corresponding Mie coefficients 0027 stAbcdn1.an1=stM.Calphakn1{kk+1}; 0028 stAbcdn1.bn1=stM.Cbetakn1{kk+1}; 0029 stAbcdn1.cn1=stM.Cgammakn1{kk+1}; 0030 stAbcdn1.dn1=stM.Cdeltakn1{kk+1}; 0031 if (kk==nK) % outside region 0032 sRegion='Outside'; 0033 elseif (kk==0) % inside sphere 0034 sRegion='Inside'; 0035 else % other cases 0036 sRegion='General'; 0037 end 0038 stEsurf=PweEsurf(stM.lambda,stM.Cepsilon{kk+1},stAbcdn1,r0,nNbTheta,sRegion,stPinTaun); 0039 end 0040 0041 0042 end 0043