[20498] | 1 | Index: ../trunk-jpl/src/m/psl/shlm.m
|
---|
| 2 | ===================================================================
|
---|
| 3 | --- ../trunk-jpl/src/m/psl/shlm.m (revision 0)
|
---|
| 4 | +++ ../trunk-jpl/src/m/psl/shlm.m (revision 19323)
|
---|
| 5 | @@ -0,0 +1,29 @@
|
---|
| 6 | +function sh_lm = shlm(index,sh,lMax,func,areas)
|
---|
| 7 | +
|
---|
| 8 | +%SHLM :: a function to compute SH coefficients of a function
|
---|
| 9 | +%
|
---|
| 10 | +%USAGE: sh_lm = shlm(index,sh,lMax,func,areas);
|
---|
| 11 | +%
|
---|
| 12 | +%index (md.mesh.elements)
|
---|
| 13 | +%sh (spherical harmonics)
|
---|
| 14 | +%lMax (maximum SH degree to be considered)
|
---|
| 15 | +%func (any function)
|
---|
| 16 | +%areas (area of elements)
|
---|
| 17 | +%
|
---|
| 18 | +
|
---|
| 19 | +p = 0;
|
---|
| 20 | +
|
---|
| 21 | +sh_lm = zeros((lMax+1)^2,1);
|
---|
| 22 | +%sh_lm = zeros(1,(lMax+1)^2);
|
---|
| 23 | +
|
---|
| 24 | +% weighted area integration over the unit sphere
|
---|
| 25 | +for l=0:lMax
|
---|
| 26 | + for m=-l:l
|
---|
| 27 | + func0 = sh(:,1+p).*func;
|
---|
| 28 | + sh_lm(1+p) = sum(mean(func0(index),2).*areas);
|
---|
| 29 | + p = p+1;
|
---|
| 30 | + end
|
---|
| 31 | +end
|
---|
| 32 | +sh_lm = sh_lm/sum(areas);
|
---|
| 33 | +%sh_lm = sh_lm*4*pi/sum(areas);
|
---|
| 34 | +
|
---|
| 35 |
|
---|
| 36 | Property changes on: ../trunk-jpl/src/m/psl/shlm.m
|
---|
| 37 | ___________________________________________________________________
|
---|
| 38 | Added: svn:executable
|
---|
| 39 | + *
|
---|
| 40 |
|
---|