Index: ../trunk-jpl/src/m/psl/shlm.m =================================================================== --- ../trunk-jpl/src/m/psl/shlm.m (revision 0) +++ ../trunk-jpl/src/m/psl/shlm.m (revision 19323) @@ -0,0 +1,29 @@ +function sh_lm = shlm(index,sh,lMax,func,areas) + +%SHLM :: a function to compute SH coefficients of a function +% +%USAGE: sh_lm = shlm(index,sh,lMax,func,areas); +% +%index (md.mesh.elements) +%sh (spherical harmonics) +%lMax (maximum SH degree to be considered) +%func (any function) +%areas (area of elements) +% + +p = 0; + +sh_lm = zeros((lMax+1)^2,1); +%sh_lm = zeros(1,(lMax+1)^2); + +% weighted area integration over the unit sphere +for l=0:lMax + for m=-l:l + func0 = sh(:,1+p).*func; + sh_lm(1+p) = sum(mean(func0(index),2).*areas); + p = p+1; + end +end +sh_lm = sh_lm/sum(areas); +%sh_lm = sh_lm*4*pi/sum(areas); + Property changes on: ../trunk-jpl/src/m/psl/shlm.m ___________________________________________________________________ Added: svn:executable + *