Home > SPlaC v1_0 > Mie > DIP > DipEgenThetaAllPhi.m

DipEgenThetaAllPhi

PURPOSE ^

Low-level function to calculate VSH expansions for Dipole emission for a fixed r0>0, but many theta and lambda

SYNOPSIS ^

function stEAllPhi=DipEgenThetaAllPhi(lambda,epsilon,dn0,cn1,dn1,r0,theta,sBessel,stPinTaunPnTn)

DESCRIPTION ^

 Low-level function to calculate VSH expansions for Dipole emission for a fixed r0>0, but many theta and lambda
 The VSHs used can either be of type 1 (sBessel='j') or type 3
 (sBessel='h1')
 Use r0=Inf (with 'h1') to obtain far-field properties.
 For dipole emission, we have:
 for |m|=1, c_{n,1}=c_{n,-1}, d_{n,1}=-d_{n,-1})
 and for m=0, d_{n,0} only (c_{n,0}=0).
 The fields Ecr, Ect, Esf, Em0r, Em0t given in the results are discussed in the
 supplementary information.
 This function is the same as calling PweEgenThetaAllPhi and
 DipM0EgenThetaAllPhi sequentially, but is faster since the Zn functions
 are computed only once here.

 Parameters:
 - lambda: column vector [L x 1]
           wavelengths in nm
 - epsilon: scalar or column vector [L x 1]
           epsilon of dielectric where field is evaluated
 - dn0, cn1, dn1: 3 matrices [L x nNmax]
             containing the Mie coefficients d_{n,0}, c_{n,1} and d_{n,1} for the 
             field expansion of N^(i)_{n,0}, M^(i)_{n,1}, and N^(i)_{n,1}, respectively
 - r0:     scalar [1 x 1] possibly zero (if sBessel='j')
           spherical coordinate r (in nm) of points
           r0 can be Inf to obtain far-field radiation profile
 - theta:  possibly row vector [1 x T]
           with spherical coordinate theta of points
 - sBessel: string defining the Bessel function to be used
           sBessel='j' for or sBessel='h1'
 - stPinTaunPnTn: structure (optional)
              with functions of theta pi_n, tau_n, p_n, t_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:  stEAllPhi, structure with 5 fields
           containing matrices [L x T]
           representing the five components E_{cr}, E_{ct}, E_{sf},
           E_{m0r}, E_{m0t}, such that:
           E/E_{p0} = (p'_x E_{cr} cos(phi)+p'_z E_{m0r}) e_r +
           (p'_x E_{ct} cos(phi) +p'_z E_{m0t}) e_theta + p'_x E_{sf} sin(phi) e_phi
 - stEAllPhi.Ecr is E_{cr}
 - stEAllPhi.Ect is E_{ct}
 - stEAllPhi.Esf is E_{sf}
 - stEAllPhi.Em0r is E_{m0r}
 - stEAllPhi.Em0t is E_{m0t}

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

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 nNmax=size(cn1,2);
0002 nNbLambda=length(lambda);
0003 nNbTheta=length(theta);
0004 
0005 n=1:nNmax; %[1 x nNmax]
0006 % need n-dep coeff for series (mu_n *n *(n+1) and mu_n)
0007 cffnr=sqrt((2*n+1)/(4*pi)); %[1 x nNmax] for Er
0008 mun=cffnr./(n.*(n+1)); % mu_n [1 x nNmax] for Et and Ef
0009 cffnr0=sqrt((2*n+1).*n.*(n+1)/(4*pi)); %[1 x nNmax] for Em0r
0010 mun0=cffnr0./(n.*(n+1)); % mu_{n,0} [1 x nNmax] for Em0t
0011 
0012 if r0==0
0013     % special case where r0=0
0014     % the following is equivalent to \mathbf{E}=-4/3 * mu_1 *d11 \mathbf{e}_x
0015     coef1=dn1(:,1)/sqrt(3*pi); % [L x 1]
0016     % Results are all [L x T] matrices
0017     stEAllPhi.Ecr=-coef1 * sin(theta);
0018     stEAllPhi.Ect=-coef1 * cos(theta); 
0019     stEAllPhi.Esf=coef1 * ones(1,nNbTheta);
0020     % this is equivalent to \mathbf{E}=1/sqrt(6\pi) d_{1,0} \mathbf{e}_z
0021     coef1=dn0(:,1)/sqrt(6*pi); % [L x 1]
0022     % Results are all [L x T] matrices
0023     stEAllPhi.Em0r=coef1 * cos(theta);
0024     stEAllPhi.Em0t=-coef1 * sin(theta);
0025     disp 'r0=0 in DipEgenThetaAllPhi';
0026     return
0027 end
0028 
0029 % get Zn(rho) for radial dependence and derived functions
0030 if (r0==Inf) 
0031     % for far-field radiation profile
0032     dn1Z1=zeros(nNbLambda,1); % [L x 1]
0033     icn1Z0=cn1; % [L x nNmax]
0034     dn1Z2=dn1; % [L x nNmax]
0035     mun=mun.*((-i).^(n+1));
0036     dn0Z1=zeros(nNbLambda,1); % [L x 1]
0037     dn0Z2=dn0; % [L x nNmax]
0038     mun0=mun0.*((-i).^(n+1));
0039 
0040 else
0041     rho=2*pi* sqrt(epsilon) ./lambda * r0; % column [L x 1]
0042     stZnAll=GenZnAll(nNmax,rho,sBessel); % fields are [L x nNmax]
0043     dn1Z1=dn1.*stZnAll.Z1; % [L x nNmax]
0044     icn1Z0=i*cn1.*stZnAll.Z0; % [L x nNmax]
0045     dn1Z2=dn1.*stZnAll.Z2; % [L x nNmax]
0046     dn0Z1=dn0.*stZnAll.Z1; % [L x nNmax]
0047     dn0Z2=dn0.*stZnAll.Z2; % [L x nNmax]
0048     clear stZnAll; % for memory
0049 end
0050 % get theta dependence if not provided
0051 if nargin < 9
0052     stPinTaunPnTn=DipPinTaunPnTn(nNmax,transpose(theta)); % fields are [T x nNmax]
0053 end
0054 
0055 % loop over lambda to avoid using 3-dimension matrices:
0056 % At a fixed lambda, the sum over n for all theta can be carried out
0057 % using a matrix product of the theta-and-n-dependent [T x nNmax] matrix
0058 % by a n-dependent column vector [nNmax x 1]
0059 % the result, a [T x 1] matrix is then transposed to a [1 x T] line
0060 Ersum=zeros(nNbLambda,nNbTheta);
0061 Etsum=zeros(nNbLambda,nNbTheta);
0062 Efsum=zeros(nNbLambda,nNbTheta);
0063 stEAllPhi.Em0r=zeros(nNbLambda,nNbTheta);
0064 stEAllPhi.Em0t=zeros(nNbLambda,nNbTheta);
0065 for ll=1:nNbLambda
0066     % for Er, vecN=d_{n,1} * Z_n^1(rho) * mu_n * n *(n+1)
0067     vecNdep=transpose(dn1Z1(ll,:).*cffnr); % [nNmax x 1]
0068     % Ersum=sum_n(pi_n(t) * vecN_n)
0069     % Do the sum as a matrix product (and check for loss of precision)
0070     Ersum(ll,:)=transpose(GenCheckSumMatVec(stPinTaunPnTn.pin, vecNdep, ...
0071         ['Ersum(' int2str(ll) ')'],'PweEgenThetaAllPhi')); % [1 x T]
0072     % for Et and Ef
0073     vecNdep=transpose(icn1Z0(ll,:).*mun); % [nNmax x 1]
0074     vecNdep2=transpose(dn1Z2(ll,:).*mun); % [nNmax x 1]
0075     % Do the sums and check for loss of precision
0076     tmp1=GenCheckSumMatVec(stPinTaunPnTn.pin, vecNdep, ...
0077         ['tmp1_1(' int2str(ll) ')'],'PweEgenThetaAllPhi');
0078     tmp2=GenCheckSumMatVec(stPinTaunPnTn.taun, vecNdep2, ...
0079         ['tmp2_1(' int2str(ll) ')'],'PweEgenThetaAllPhi');
0080     Etsum(ll,:)=transpose(GenCheckSum2Mat(tmp1,tmp2, ...
0081         ['Etsum(' int2str(ll) ')'],'PweEgenThetaAllPhi')); % [1 x T]
0082         
0083     tmp1=GenCheckSumMatVec(stPinTaunPnTn.taun, vecNdep, ...
0084         ['tmp1_2(' int2str(ll) ')'],'PweEgenThetaAllPhi');
0085     tmp2=GenCheckSumMatVec(stPinTaunPnTn.pin, vecNdep2, ...
0086         ['tmp2_2(' int2str(ll) ')'],'PweEgenThetaAllPhi');
0087     Efsum(ll,:)=transpose(GenCheckSum2Mat(tmp1,tmp2, ...
0088         ['Efsum(' int2str(ll) ')'],'PweEgenThetaAllPhi')); % [1 x T]
0089 
0090     % for Em0r, vecN=d_{n,0} * Z_n^1(rho) * mu_{n,0} * n *(n+1)
0091     vecNdep=transpose(dn0Z1(ll,:).*cffnr0); % [nNmax x 1]
0092     % Ersum=sum_n(p_n(t) * vecN_n)
0093     % Do the sum as a matrix product (and check for loss of precision)
0094     stEAllPhi.Em0r(ll,:)=transpose(GenCheckSumMatVec(stPinTaunPnTn.pn, vecNdep, ...
0095         ['Em0rsum(' int2str(ll) ')'],'DipM0EgenThetaAllPhi')); % [1 x T]
0096     % for Em0t
0097     vecNdep=transpose(dn0Z2(ll,:).*mun0); % [nNmax x 1]
0098     % Do the sums and check for loss of precision
0099     stEAllPhi.Em0t(ll,:)=transpose(GenCheckSumMatVec(stPinTaunPnTn.tn, vecNdep, ...
0100         ['Em0tsum(' int2str(ll) ')'],'DipM0EgenThetaAllPhi'));
0101 
0102 end
0103 
0104 % Results are all [L x T] matrices
0105 stEAllPhi.Ecr=-2*repmat(sin(theta),nNbLambda,1).*Ersum;
0106 stEAllPhi.Ect=-2*Etsum; 
0107 stEAllPhi.Esf=2*Efsum; 
0108

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)