-
Notifications
You must be signed in to change notification settings - Fork 0
/
IDLT.m
53 lines (36 loc) · 1.23 KB
/
IDLT.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
function [ Flm ] = IDLT( Fkm, l, m, w, PL )
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Spherical Harmonic Expansion
% By Javier Cebeiro and Marcela Morvidone
% Centro de Matemática Aplicada, Universidad Nacional de San Martin
% Buenos Aires, Argentina
% Labo ETIS, Equipes Traitement de l'Information et Systèmes/ENSEA/UCP
% France
% 2019
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Calculate the Inverse Discrete Legendre Transform (IDLT) for indices m
% and l using weights w and Legendre functions PL.
% INPUT
% Fkm : for a given m
% w : integration weight
% PL : set of legendre functions
% l, m: indices for SHE
% OUTPUT
% Flm:
Plm = PL( :, l + 1, abs(m) + 1 );
if m>=0
THETAlm = Plm;
else
THETAlm = (-1)^m *Plm;
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% IMPORTANT: Previous if is indeed FASTER than the following commands, do
% not feel tempted to use it
% factor = m>=0 + (-1)^m*(m<0);
% THETAlm = factor*Plm;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% performs numerical integration using the vector of coefficients w
Flm = sum(Fkm.*THETAlm.*w);
end