-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdsmcoupling.m
167 lines (143 loc) · 3.87 KB
/
dsmcoupling.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
function dsmcoupling(as,np)
% DSMCOUPLING(as,np)
%
% Makes a plot of the coupling matrix for boxcar windows
% Dahlen & Simons (2007), Figure 7
%
% INPUT:
%
% as 1 also plot asymptotic relation [default: 0]
% np Number of panels [default: 4]
%
% Last modified by fjsimons-at-alum.mit.edu, 02/07/2007
defval('Lmax',150)
defval('as',0)
defval('np',4)
% Bandwidths of left and right column of panels
L1=[5 10];
L2=[20 30];
% X-axis limits
xma1=20;
xma2=40;
xti1=[20 20];
xti2=[40 40];
xtag=['offset from target degree l'' - l'];
% Y-axis ticks and limits
yti1=[3 5];
yti2=[1 2 2];
yma1=[15 9];
yma2=[6 3];
ytag=sprintf(['100 %s M_{ll''} (%s)'],'\times','%');
clf
nr=3;
[ah,ha]=krijetem(subnum(nr,2));
fig2print(gcf,'portrait')
% FIRST COLUMN
for ondex=1:length(L1)
axes(ha(ondex))
L=L1(ondex);
% Get the eigenvalue-weighted multitaper coupling kernel
K=mcouplings(L,Lmax);
if as==1
% And get the asymptotic representation fake for the last one
[Kas,elas]=universal(L,0);
% What seems to be the scaling factor here?
scK=K(llast,llast)/max(Kas);
disp(sprintf('Scaling is %8.3f',scK))
Kas=Kas*100;
end
% Somehow normalize this to the effective bandwidth as percentage
% leaked to, from and within the effective bandwidth
K=K*100;
% Which one are we plotting? The last complete degree (not index)
llast=Lmax-L;
% Check row sum
Ksum=sum(K(llast+1,max(1,llast-L):Lmax+1));
disp(sprintf('Row sum at degree shown %8.3f',Ksum))
difer(Ksum-100)
if as==1
plot(elas,Kas*scK,'k','linew',1)
hold on
end
b=bar(0-llast:Lmax-llast,K(llast+1,:),1);
set(b,'FaceC',grey,'EdgeC','k')
ylim([0 yma1(ondex)])
set(ha(ondex),'ytick',[0:yti1(ondex):yma1(ondex)])
xlim([-xma1 xma1])
tix{ondex}=[0:xti1(ondex):xma1 -L L];
xl(ondex)=xlabel(xtag);
yl(ondex)=ylabel(ytag);
% Put in bandwidth labels
legsi{ondex}=sprintf(' L = %i ',L);
[bh(ondex),th(ondex)]=boxtex('ur',ha(ondex),legsi{ondex},12,1,1,1);
end
% SECOND COLUMN
for ondex=1:length(L2)
panid=ondex+length(L1)+(nr-length(L1));
axes(ha(panid));
L=L2(ondex);
% Get the boxcar coupling kernel
K=mcouplings(L,Lmax);
if as==1
% And get the asymptotic representation fake for the last one
[Kas,elas]=universal(L,0);
% What seems to be the scaling factor here?
scK=K(llast,llast)/max(Kas);
disp(sprintf('Scaling is %8.3f',scK))
Kas=Kas*100;
end
% Somehow normalize this to the effective bandwidth as percentage
% leaked to, from and within the effective bandwidth
K=K*100;
% Which one are we plotting?
llast=Lmax-L;
% Check the row sum
Ksum=sum(K(llast+1,max(1,llast-L):Lmax+1));
disp(sprintf('Row sum at degree shown %8.3f',Ksum))
difer(Ksum-100)
if as==1
plot(elas,Kas,'k','linew',1)
hold on
end
b=bar(0-llast:Lmax-llast,K(llast+1,:),1);
set(b,'FaceC',grey,'EdgeC','k')
ylim([0 yma2(ondex)])
set(ha(panid),'ytick',[0:yti2(ondex):yma2(ondex)])
xlim([-xma2 xma2])
tix{panid}=[0:xti2(ondex):xma2 -L L];
xl(panid)=xlabel(xtag);
yl(panid)=ylabel(ytag);
% Put in bandwidth labels
legsi{panid}=sprintf(' L = %i ',L);
[bh(panid),th(panid)]=...
boxtex('ur',ha(panid),legsi{panid},12,1,1);
end
% Cosmetic arrangements
longticks(ah)
movs=1e9; % Don't do this here unless you do it everywhere
for ondex=1:length(L1)
set(ha(ondex),'xtick',unique([-tix{ondex} tix{ondex}]),'xgrid','on')
movev(bh(ondex),-yma1(ondex)/movs)
movev(th(ondex),-yma1(ondex)/movs)
end
for ondex=1:length(L2)
panid=ondex+length(L1)+(nr-length(L1));
set(ha(panid),'xtick',unique([-tix{panid} tix{panid}]),'xgrid','on')
movev(bh(panid),-yma2(ondex)/movs)
movev(th(panid),-yma2(ondex)/movs)
end
% Four panels or six?
if np==4
delete(xl([1 4]))
delete(ah(5:6))
else
delete(xl([1:2 4:5]))
end
serre(ha(1:2),1/30,'down')
serre(ha(4:5),1/30,'down')
set(gcf,'color','w','inverthardcopy','off')
if as==1
figdisp([],as)
else
figdisp
end