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

DipPinTaunPnTn

PURPOSE ^

Computes angle functions pi_n(cos(theta)) and tau_n(cos(theta)) (for |m|=1) and p_n(cos(theta)) and t_n(cos(theta)) (for m=0) for n=1..nNmax

SYNOPSIS ^

function stPinTaunPnTn=DipPinTaunPnTn(nNmax, theta, sM0only)

DESCRIPTION ^

 Computes angle functions pi_n(cos(theta)) and tau_n(cos(theta)) (for |m|=1) and p_n(cos(theta)) and t_n(cos(theta)) (for m=0) for n=1..nNmax

 Parameters:
 - nNmax: scalar integer [1 x 1]
 - theta: column vector [T x 1]
          with theta (in radians)
          all theta's must be between 0 and pi
 - sM0only: optional string
            if sM0only='m0only', then only p_n and t_n are computed
 
 Returns: structure with fields:
 - pin: matrix [T x nNmax] with pi_n(cos(theta)) n=1..nNmax
 - taun: matrix [T x nNmax] with tau_n(cos(theta)) n=1..nNmax
 - pn: matrix [T x nNmax] with p_n(cos(theta)) n=1..nNmax
 - tn: matrix [T x nNmax] with t_n(cos(theta)) n=1..nNmax

 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 if size(theta,2)>1
0002     disp 'Warning: theta must be a column vector in DipPinTaunPnTn...';
0003 end
0004 if nargin<3, sM0only='no'; end
0005 
0006 if ~strcmpi(sM0only,'m0only')
0007     % Get first pin and tau from the Pwe function
0008     stPinTaunPnTn=PwePinTaun(nNmax,theta);
0009     % the structure contain pin and taun
0010 end
0011 
0012 % Now get p_n and t_n by recurrence
0013 nrows=length(theta);
0014 muc=cos(theta); % column [T x 1]
0015 mus=sin(theta); % column [T x 1]
0016 
0017 % Initialize recurrence p_0=1, p_1=muc, t_0=0, t_1=-mus
0018 % pnm1 contains p_{n-1} n=1..nNmax+1, same for tnm1
0019 pnm1=ones(nrows,nNmax+1); % [T x N+1]
0020 pnm1(:,2)=muc; % [T x 1]
0021 tnm1=zeros(nrows,nNmax+1); % [T x N+1]
0022 tnm1(:,2)=-mus; % [T x 1]
0023 
0024 % Get p_2 to p_nNmax and t_2 to t_nNmax by recurrence
0025 % p_n is pnm1(:,n+1), t_n is tnm1(:,n+1)
0026 for n=2:(nNmax)
0027     pnm1(:,n+1)=(2*n-1)/(n)*muc.*pnm1(:,n)-(n-1)/n*pnm1(:,n-1);
0028     tnm1(:,n+1)=muc.*tnm1(:,n)-n*mus.*pnm1(:,n);
0029 end;
0030 
0031 % return p_n and t_n matrices (except n=0)
0032 stPinTaunPnTn.pn=pnm1(:,2:(nNmax+1));
0033 stPinTaunPnTn.tn=tnm1(:,2:(nNmax+1));
0034

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)