Home > SPlaC v1_0 > Mie > GEN > GenRBall.m

GenRBall

PURPOSE ^

Calculates both Ricatti-Bessel functions psi_n(rho) and xi_n(rho) and their derivative for n=1:nNmax

SYNOPSIS ^

function stRBall=GenRBall(nNmax, rho)

DESCRIPTION ^

 Calculates both Ricatti-Bessel functions psi_n(rho) and xi_n(rho) and their derivative for n=1:nNmax
 This function is faster than calling GenRBpsi2 and GenRBxi2 sequentially

 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 stRBall with 4 fields
             each a matrix [R x nNmax] for each rho and n=1..nNmax
 - stRBall.psi:  psi_n(rho)
 - stRBall.xi:   xi_n(rho)
 - stRBall.Dpsi: psi'_n(rho)
 - stRBall.Dxi:  xi'_n(rho)

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

EXAMPLE OF OUTPUT ^

Example figure output

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 n=1:nNmax;
0002 nm1=0:nNmax;
0003 nu=nm1+0.5;
0004 
0005 [fj ierr1]=besselj(nu,rho);
0006 [f ierr2]=besselh(nu,rho);
0007 
0008 if (max(max(ierr1)) > 0)
0009     disp 'Error in besselj in GenRBall'
0010 end
0011 if (max(max(ierr2)) > 0)
0012     disp 'Error in besselh in GenRBall'
0013 end
0014 
0015 sq=sqrt((pi/2).*rho); % [R x 1]
0016 sqmat=repmat(sq,1,nNmax+1); % [R x nNmax+1]
0017 fj=fj.*sqmat;
0018 % fj is now matrix of spherical Ricati-Bessel
0019 % psi_n(rho), n=0..nNmax or equivalently psi_{n-1}(rho), n=1..nNmax+1
0020 f=f.*sqmat;
0021 % f is now matrix of Ricatti-Bessel
0022 % xi_n(rho), n=0..nNmax or equivalently xi_{n-1}(rho), n=1..nNmax+1
0023 
0024 rhomat=repmat(rho,1,nNmax); % [R x nNmax]
0025 nmat=repmat(n,length(rho),1); % [R x nNmax]
0026 
0027 % Computes: psi_n'=psi_{n-1} - n psi_n/rho
0028 % and check for loss of precision in sum
0029 stRBall.Dpsi=GenCheckSum2Mat(fj(:,n),- nmat.*fj(:,n+1)./rhomat,'Dpsi','GenRBall');
0030 
0031 % Computes: xi_n'=xi_{n-1} - n xi_n/rho
0032 % and check for loss of precision in sum
0033 stRBall.Dxi=GenCheckSum2Mat(f(:,n), - nmat.*f(:,n+1)./rhomat,'Dxi','GenRBall');
0034 
0035 stRBall.psi=fj(:,n+1);
0036 stRBall.xi=f(:,n+1);
0037 
0038 
0039 
0040

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)