Calculates the Ricatti-Bessel function xi_n(rho)=h1_n(rho)*rho and its derivative for n=1:nNmax Parameters: - nNmax: scalar integer number of n in series - rho: column vector [R x 1] (no zero components allowed) arguments of the Ricatti-Bessel function Returns: structure with 2 fields each a matrix [R x nNmax] with values for each rho and n=1..nNmax stRBxi2.xi: xi_n(rho) stRBxi2.Dxi: xi'_n(rho)} This file is part of the SPlaC v1.0 package (copyright 2008) Check the README file for further information
0001 n=1:nNmax; 0002 nm1=0:nNmax; 0003 nu=nm1+0.5; 0004 [f ierr1]=besselh(nu,rho); 0005 % f is matrix [R x nNmax+1] of cylindrical Hankel 0006 % H1_{n+0.5}(rho), n=0..nNmax 0007 0008 if (max(max(ierr1)) > 0) 0009 disp 'Error in besselh in GenRBxi2' 0010 end 0011 0012 sq=sqrt((pi/2).*rho); % [R x 1] 0013 sqmat=repmat(sq,1,nNmax+1); % [R x nNmax+1] 0014 f=f.*sqmat; 0015 % f is now matrix of Ricatti-Bessel 0016 % xi_n(rho), n=0..nNmax or equivalently xi_{n-1}(rho), n=1..nNmax+1 0017 0018 stRBxi2.xi=f(:,n+1); 0019 0020 rhomat=repmat(rho,1,nNmax); % [R x nNmax] 0021 nmat=repmat(n,length(rho),1); % [R x nNmax] 0022 0023 % Computes: xi_n'=xi_{n-1} - n xi_n/rho 0024 % and check for loss of precision in sum 0025 stRBxi2.Dxi=GenCheckSum2Mat(f(:,n), - nmat.*f(:,n+1)./rhomat,'Dxi','GenRBxi2'); 0026 0027 0028 0029