computes the three Zn(rho) auxiliary functions for the radial dependence of VSHs for n=1 to nNmax can be used for both regular VSHs (based on j(rho)) or irregular VSHs (based on h1(rho)). Parameters: - nNmax: scalar integer number of n in series - rho: column vector [R x 1] (no zero components allowed, even for regular VSH, for speed optimization) arguments of the VSHs - sBessel: string defining the Bessel function to be used sBessel='j' for or sBessel='h1' Returns: stZnAll structure with 3 fields containing matrices [R x nNmax] - stZnAll.Z0 is Z_n^0(rho) - stZnAll.Z1 is Z_n^1(rho) - stZnAll.Z2 is Z_n^2(rho) This file is part of the SPlaC v1.0 package (copyright 2008) Check the README file for further information
0001 if ~isempty(find(rho==0,1)) 0002 disp 'Warning: rho=0 arguments not allowed in GenZnAll...' 0003 end 0004 0005 n=1:nNmax; 0006 nm1=0:nNmax; 0007 nu=nm1+0.5; 0008 0009 if strcmp(sBessel,'h1') 0010 [f ierr]=besselh(nu,rho); 0011 if (max(max(ierr)) > 0) 0012 disp 'Error in besselh in GenZnAll' 0013 end 0014 else 0015 if strcmp(sBessel,'j') 0016 [f ierr]=besselj(nu,rho); 0017 if (max(max(ierr)) > 0) 0018 disp 'Error in besselj in GenZnAll' 0019 end 0020 else 0021 disp 'Error in GetZnAll: wrong sBessel string...' 0022 end; 0023 end; 0024 0025 % f is matrix [R x nNmax+1] of cylindrical Bessel 0026 % Z_{n+0.5}(rho), n=0..nNmax 0027 0028 sq=sqrt((pi/2)./rho); % [R x 1] 0029 sqmat=repmat(sq,1,nNmax+1); % [R x nNmax+1] 0030 f=f.*sqmat; 0031 % f is now matrix of spherical Bessel 0032 % z_n(rho), n=0..nNmax or equivalently z_{n-1}(rho), n=1..nNmax+1 0033 0034 0035 rhomat=repmat(rho,1,nNmax); % [R x nNmax] 0036 nmat=repmat(n,length(rho),1); % [R x nNmax] 0037 0038 stZnAll.Z0=f(:,2:(nNmax+1)); 0039 stZnAll.Z1=stZnAll.Z0 ./ rhomat; 0040 0041 % Computes: Z2_n=z_{n-1} - n Z1_n 0042 % check for loss of precision in sum 0043 stZnAll.Z2=GenCheckSum2Mat(f(:,n), -nmat.*stZnAll.Z1,'Z2','GenZnAll'); 0044 0045 0046