-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvectansdwcap.m
60 lines (53 loc) · 1.62 KB
/
vectansdwcap.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
54
55
56
57
58
59
60
function [V,C,Vm,Cm]=vectansdwcap(TH,L,m)
% [V,C,Vm,Cm]=vectansdwcap(TH,L,m)
%
% Spherical-harmonic localization to a single fixed-order spherical polar
% cap, bandlimited and optimally spatially concentrated solutions. For the
% tangential component of the vector Slepian functions.
%
% INPUT:
%
% TH angular extent of the spherical cap (semi-opening angle) in degrees
% or two angles for ring between
% L maximum spherical-harmonic degree
% m spherical-harmonic order
%
% OUTPUT:
%
% V eigenvalues for positive (or zero) m
% C eigenvectors = coefficients for the tangential vector spherical
% harmonics Blm and Clm for positive (or zero) m
% Vm eigenvalues for negative m
% Cm eigenvectors = coefficients for the tangential vector spherical
% harmonics Blm and Clm for negative m
%
% Last modified by plattner-at-alumni.ethz.ch, 5/8/2017
dirname=fullfile(getenv('IFILES'),'VECTANSDWCAP');
fnpl=fullfile(dirname,sprintf(...
'VECTANSDW-%f-%f-%i-%i-%i.mat',min(TH),max(TH),min(L),max(L),m));
if exist(fnpl,'file')==2
load(fnpl)
disp(sprintf('%s loaded by CAPVECTORSLEPIAN',fnpl))
else
if length(TH)==2
[Mm1,Mmm1]=kerneltancapm(max(TH),L,m);
[Mm2,Mmm2]=kerneltancapm(min(TH),L,m);
Mm=Mm1-Mm2;
Mmm=Mmm1-Mmm2;
else
[Mm,Mmm]=kerneltancapm(TH,L,m);
end
% Positive m
[C,V]=eig(Mm);
[V,isrt]=sort(sum(V,1),'descend');
C=C(:,isrt);
% Negative m
if m~=0
[Cm,Vm]=eig(Mmm);
[Vm,isrtm]=sort(sum(Vm,1),'descend');
Cm=Cm(:,isrtm);
else
Cm=C; Vm=V;
end
save(fnpl,'C','V','Cm','Vm');
end