Calculates the incident electric field E from its PWE expression for a fixed lambda0 but many r and theta The PWE expression is simply \mathbf{E}=exp(i kM z) \mathbf{e}_x The fields Ecr, Ect, Esf given in the results are discussed in the supplementary information. lambda0 and epsilon0 MUST BE A SCALAR here (one wavelength only) Parameters: - lambda0: SCALAR [1 x 1] wavelengths in nm - epsilonM0: SCALAR [1 x 1] epsilon of dielectric of outside region - r: possibly column vector [R x 1] spherical coordinate r (in nm) of points - theta: possibly row vector [1 x T] with spherical coordinate theta of points Returns: stEAllPhi, structure with 3 fields containing matrices [R x T] representing the three components E_{cr}, E_{ct}, E_{sf} such as: of E = E_{cr} cos(phi) e_r + E_{ct} cos(phi) e_theta + E_{sf} sin(phi) e_phi - stEAllPhi.Ecr is E_{cr} - stEAllPhi.Ect is E_{ct} - stEAllPhi.Esf is E_{sf} This file is part of the SPlaC v1.0 package (copyright 2008) Check the README file for further information
0001 nNbR=length(r); 0002 0003 % exp(ikM z) is [R x T], obtained by matrix product of [R x 1] by [1 x T] 0004 phasefact=exp(i*2*pi*sqrt(epsilonM0)/lambda0 * ( r * cos(theta) ) ); 0005 0006 % Results are all [R x T] matrices 0007 % They result from Eq. H.16 for e_x and H.76 for E_inc 0008 stEAllPhi.Ecr= phasefact .* repmat(sin(theta),nNbR,1); 0009 stEAllPhi.Ect= phasefact .* repmat(cos(theta),nNbR,1); 0010 stEAllPhi.Esf= - phasefact; 0011