[20498] | 1 | Index: ../trunk-jpl/src/m/psl/sharmonics.m
|
---|
| 2 | ===================================================================
|
---|
| 3 | --- ../trunk-jpl/src/m/psl/sharmonics.m (revision 0)
|
---|
| 4 | +++ ../trunk-jpl/src/m/psl/sharmonics.m (revision 19297)
|
---|
| 5 | @@ -0,0 +1,37 @@
|
---|
| 6 | +function sh = sharmonics(lat,lon,lMax)
|
---|
| 7 | +
|
---|
| 8 | +%SHarmonics :: a function to compute (ortho-)normalized shperical harmonics
|
---|
| 9 | +%
|
---|
| 10 | +%USAGE: sh = sharmonics(lat,lon,lmax);
|
---|
| 11 | +%
|
---|
| 12 | +%lat (latitude in [0,180] degrees from the north pole)
|
---|
| 13 | +%lon (longitude in [0 360] degrees)
|
---|
| 14 | +%lmax (maximum SH degree you wish to compute)
|
---|
| 15 | +%
|
---|
| 16 | +%sh (spherical harmonics of degree and orders up to "lmax"...
|
---|
| 17 | +%...numbered as 1(l=0), 2(l=1,m=-1), 3(l=1,m=0), 4(l=1,m=1)...)
|
---|
| 18 | +%
|
---|
| 19 | +
|
---|
| 20 | +q=0;
|
---|
| 21 | +%
|
---|
| 22 | +lat=lat*pi/180;
|
---|
| 23 | +lon=lon*pi/180;
|
---|
| 24 | +
|
---|
| 25 | +%ortho-normalized SH
|
---|
| 26 | +for l=0:lMax
|
---|
| 27 | + plm = legendre(l,cos(lat),'norm');
|
---|
| 28 | + for m=-l:l
|
---|
| 29 | + if(m<0)
|
---|
| 30 | + sh(:,1+q)=(-1)^(abs(m))*2.*plm(abs(m)+1,:)'.*sin(abs(m).*lon);
|
---|
| 31 | + elseif(m==0)
|
---|
| 32 | + sh(:,1+q)=sqrt(2)*plm(abs(m)+1,:)';
|
---|
| 33 | + else
|
---|
| 34 | + sh(:,1+q)=(-1)^(abs(m))*2.*plm(abs(m)+1,:)'.*cos(abs(m).*lon);
|
---|
| 35 | + end
|
---|
| 36 | + q=q+1;
|
---|
| 37 | + end
|
---|
| 38 | + %disp(['Spherical Harmonics of degree ',num2str(l),' (of ',num2str(lMax),') computed!']);
|
---|
| 39 | +end
|
---|
| 40 | +disp(['Spherical Harmonics of degree and orders up to ',num2str(lMax),' computed!']);
|
---|
| 41 | +
|
---|
| 42 | +
|
---|
| 43 |
|
---|
| 44 | Property changes on: ../trunk-jpl/src/m/psl/sharmonics.m
|
---|
| 45 | ___________________________________________________________________
|
---|
| 46 | Added: svn:executable
|
---|
| 47 | + *
|
---|
| 48 |
|
---|