source: issm/oecreview/Archive/19101-20495/ISSM-19322-19323.diff@ 20498

Last change on this file since 20498 was 20498, checked in by Mathieu Morlighem, 9 years ago

CHG: done with Archive/19101-20495

File size: 1.0 KB
RevLine 
[20498]1Index: ../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
36Property changes on: ../trunk-jpl/src/m/psl/shlm.m
37___________________________________________________________________
38Added: svn:executable
39 + *
40
Note: See TracBrowser for help on using the repository browser.