Home > SPlaC v1_0 > Ellipsoids > EllGeomFact.m

EllGeomFact

PURPOSE ^

Returns geometrical factors associated with a given general ellipsoid

SYNOPSIS ^

function stEllGeom = EllGeomFact(a,b,c,sOption)

DESCRIPTION ^

 Returns geometrical factors associated with a given general ellipsoid
 All properties are computed using double integrals
 as explained in Sec. G.1.5

 Parameters:
 - a,b,c: scalars or row vectors [1 x G]
          semi-axis length along x,y,z
 - sOptions: string (optional)
           if 'L', only L_1, L_2, L_3 are returned
           if 'x','y', or 'z', only properties related to corresponding
           axis are computed
           if 'All' (default), then all properties are returned
 Returns:
 - stEllGeom: structure with fields, all of size [1 x G]
 stEllGeom.a, b, c for future reference
 stEllGeom.S: surface area (in squared units of a, b, and c)
 stEllGeom.type: ='General' (type of ellipsoid)
 stEllGeom.L1, L2, L3: Geometrical factors (see Sec. G.1.5)
 stEllGeom.exix2ave: <|e_xi . e_x|^2>
 stEllGeom.exiy2ave: <|e_xi . e_y|^2>
 stEllGeom.exiz2ave: <|e_xi . e_z|^2>
 stEllGeom.exix4ave: <|e_xi . e_x|^4>
 stEllGeom.exiy4ave: <|e_xi . e_y|^4>
 stEllGeom.exiz4ave: <|e_xi . e_z|^4>
 stEllGeom.exix2y2ave: <|e_xi . e_x|^2 |e_xi . e_y|^2>
 stEllGeom.exix2z2ave: <|e_xi . e_x|^2 |e_xi . e_z|^2>
 stEllGeom.exiy2z2ave: <|e_xi . e_y|^2 |e_xi . e_z|^2>

 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 nargin<4, sOption='All'; end
0002 
0003 bxaxis=true; byaxis=true; bzaxis=true;
0004 if strcmpi(sOption,'x'), byaxis=false; bzaxis=false; end
0005 if strcmpi(sOption,'y'), bxaxis=false; bzaxis=false; end
0006 if strcmpi(sOption,'z'), bxaxis=false; byaxis=false; end
0007 
0008 nNbG=length(a);
0009 
0010 stEllGeom.a=a;
0011 stEllGeom.b=b;
0012 stEllGeom.c=c;
0013 stEllGeom.type='General'; % for reference
0014 
0015 % initialize all variables (in case they are arrays, i.e. if nNbG>1)
0016 zeroa=0*a; % zeros same size as a
0017 stEllGeom.S=zeroa;
0018 if (bxaxis), stEllGeom.L1=zeroa;
0019 stEllGeom.exix2ave=zeroa; stEllGeom.exix4ave=zeroa; end
0020 if (byaxis), stEllGeom.L2=zeroa;
0021 stEllGeom.exiy2ave=zeroa; stEllGeom.exiy4ave=zeroa; end
0022 if (bzaxis), stEllGeom.L3=zeroa;
0023 stEllGeom.exiz2ave=zeroa; stEllGeom.exiz4ave=zeroa; end
0024 if strcmpi(sOption,'All')
0025     stEllGeom.exix2y2ave=zeroa;
0026     stEllGeom.exix2z2ave=zeroa;
0027     stEllGeom.exiy2z2ave=zeroa;
0028 end
0029         
0030 % loop through each set of geometrical parameters
0031 for indg=1:nNbG
0032 
0033     abc=a(indg)*b(indg)*c(indg);
0034     % function for sqrt{s}
0035     fsqrts=@(t,f) (b(indg)^2*c(indg)^2*sin(t).^2.*cos(f).^2 ...
0036         +a(indg)^2*c(indg)^2*sin(t).^2.*sin(f).^2+a(indg)^2*b(indg)^2*cos(t).^2).^(1/2);
0037 
0038     % surface area
0039     dfint = @(t,f) sin(t).*fsqrts(t,f);
0040     S=dblquad(dfint,0,pi,0,2*pi);
0041     stEllGeom.S(indg)=S;
0042     % function for sin(t)/r^3
0043     fstovr3=@(t,f) sin(t)./(a(indg)^2*sin(t).^2.*cos(f).^2 + b(indg)^2*sin(t).^2.*sin(f).^2 ...
0044         + c(indg)^2*cos(t).^2).^(3/2);
0045 
0046     % geometrical factors (Eq. G.43 and permutations)
0047     if (bxaxis)
0048         % for x/a
0049         fxova= @(t,f) sin(t).*cos(f);
0050         % function to intergrate (function of theta=t and phi=f)
0051         dfint = @(t,f) abc/(4*pi)*fxova(t,f).^2 .* fstovr3(t,f);
0052         stEllGeom.L1(indg)=dblquad(dfint,0,pi,0,2*pi);
0053     end
0054     if (byaxis)
0055         % for y/b
0056         fyovb= @(t,f) sin(t).*sin(f);
0057         dfint = @(t,f) abc/(4*pi)*fyovb(t,f).^2 .* fstovr3(t,f);
0058         stEllGeom.L2(indg)=dblquad(dfint,0,pi,0,2*pi);
0059     end
0060     if (bzaxis)
0061         % for z/c
0062         fzovc= @(t,f) cos(t);
0063         dfint = @(t,f) abc/(4*pi)*fzovc(t,f).^2 .* fstovr3(t,f);
0064         stEllGeom.L3(indg)=dblquad(dfint,0,pi,0,2*pi);
0065     end
0066 
0067     if ~strcmpi(sOption,'L') % compute other geometrical averages
0068 
0069         if (bxaxis)
0070             dfint= @(t,f) (b(indg)*c(indg))^2 *fxova(t,f).^2 ./ fsqrts(t,f) .* sin(t);
0071             stEllGeom.exix2ave(indg)=dblquad(dfint,0,pi,0,2*pi)/S;
0072             dfint= @(t,f) (b(indg)*c(indg))^4 * fxova(t,f).^4 ./ fsqrts(t,f).^3 .* sin(t);
0073             stEllGeom.exix4ave(indg)=dblquad(dfint,0,pi,0,2*pi)/S;
0074         end
0075         if (byaxis)
0076             dfint= @(t,f) (a(indg)*c(indg))^2 *fyovb(t,f).^2 ./ fsqrts(t,f) .* sin(t);
0077             stEllGeom.exiy2ave(indg)=dblquad(dfint,0,pi,0,2*pi)/S;
0078             dfint= @(t,f) (a(indg)*c(indg))^4 * fyovb(t,f).^4 ./ fsqrts(t,f).^3 .* sin(t);
0079             stEllGeom.exiy4ave(indg)=dblquad(dfint,0,pi,0,2*pi)/S;
0080         end
0081         if (bzaxis)
0082             if (bxaxis && byaxis)
0083                 stEllGeom.exiz2ave(indg)=1-stEllGeom.exix2ave(indg)-stEllGeom.exiy2ave(indg);
0084             else
0085                 % alternative for direct calculation of exiz2ave
0086                 dfint= @(t,f) (a(indg)*b(indg))^2 *fzovc(t,f).^2 ./ fsqrts(t,f) .* sin(t);
0087                 stEllGeom.exiz2ave(indg)=dblquad(dfint,0,pi,0,2*pi)/S;
0088             end
0089             dfint= @(t,f) (a(indg)*b(indg))^4 * fzovc(t,f).^4 ./ fsqrts(t,f).^3 .* sin(t);
0090             stEllGeom.exiz4ave(indg)=dblquad(dfint,0,pi,0,2*pi)/S;
0091         end
0092 
0093         if strcmpi(sOption,'All')
0094             stEllGeom.exix2y2ave(indg)=(1-2*stEllGeom.exiz2ave(indg)+stEllGeom.exiz4ave(indg) ...
0095                 -stEllGeom.exix4ave(indg)-stEllGeom.exiy4ave(indg))/2;
0096             stEllGeom.exix2z2ave(indg)=(1-2*stEllGeom.exiy2ave(indg)+stEllGeom.exiy4ave(indg) ...
0097                 -stEllGeom.exix4ave(indg)-stEllGeom.exiz4ave(indg))/2;
0098             stEllGeom.exiy2z2ave(indg)=(1-2*stEllGeom.exix2ave(indg)+stEllGeom.exix4ave(indg) ...
0099                 -stEllGeom.exiy4ave(indg)-stEllGeom.exiz4ave(indg))/2;
0100         end
0101         % alternative for direct calculation of cross-products
0102         % dfint= @(t,f) (abc*c(indg))^2 * fxova(t,f).^2 .* fyovb(t,f).^2 ./ fsqrts(t,f).^3 .* sin(t);
0103         % stEllGeom.exix2y2ave(indg)=dblquad(dfint,0,pi,0,2*pi)/S;
0104         % dfint= @(t,f) (abc*b(indg))^2 * fxova(t,f).^2 .* fzovc(t,f).^2 ./ fsqrts(t,f).^3 .* sin(t);
0105         % stEllGeom.exix2z2ave(indg)=dblquad(dfint,0,pi,0,2*pi)/S;
0106         % dfint= @(t,f) (abc*a(indg))^2 * fyovb(t,f).^2 .* fzovc(t,f).^2 ./ fsqrts(t,f).^3 .* sin(t);
0107         % stEllGeom.exiy2z2ave(indg)=dblquad(dfint,0,pi,0,2*pi)/S;
0108 
0109     end
0110 end
0111 
0112 
0113 
0114

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)