-
Notifications
You must be signed in to change notification settings - Fork 3
/
dsbcouplinglog.m
210 lines (177 loc) · 5.68 KB
/
dsbcouplinglog.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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
function dsbcouplinglog(as,offs)
% DSBCOUPLINGLOG(as,offs)
%
% Makes a LOG plot of the coupling matrix for boxcar windows
% Dahlen & Simons (2007), Figure 5.
%
% INPUT:
%
% as 1 also plot asymptotic relation [default: 0]
% offs An offset in the last degree plotted [default: 0]
%
% Last modified by fjsimons-at-alum.mit.edu, 1/2/2008
% Run it twice, to be safe
defval('Lmax',150)
defval('as',0)
defval('offs',0);
TH1=[10 20 30];
TH2=[15 10 5];
TH2=[30 20 10];
% EL-spacing
els=2;
els2=1;
% X-tick interval
tb=[20 10 5];
tb2=[2 2 2];
xtag=['offset from target degree l'' - l'];
clf
[ah,ha]=krijetem(subnum(3,2));
fig2print(gcf,'portrait')
% Logo scale and location
logsk=20;
cloc='ll';
aN=3;
for ondex=1:length(TH1)
axes(ha(ondex))
% Get effective bandwidth thingies
for N=1:max(5,aN)
skel(N)=max(roots([1 1 -(N*180./TH1(ondex))^2]));
end
% Get the boxcar coupling kernel
K=bcoupling(TH1(ondex),Lmax,1);
% Last l-prime we'll be showing today (a degree, not an index)
llast=Lmax-ceil(skel(aN))-offs;
disp(sprintf('We show target degree l = %i',llast))
disp(sprintf('Leftmost portion l = %i',llast-ceil(skel(aN))))
% Check the row sum, which isn't going to be 100, but just about
Ksum=sum(K(llast+1,...
max(1,llast-ceil(skel(aN)))+1:min(llast+ceil(skel(aN))+1,Lmax+1)));
disp(sprintf('Row sum at degree shown %8.3f',Ksum*100))
if as==1
% And get the asymptotic representation fake for the last one
[Kas,elas]=buniversal(TH1(ondex),Lmax,0,1);
% What seems to be the scaling factor here?
scK=K(llast,llast)/max(Kas);
disp(sprintf('Scaling is %8.3f',scK))
Kas=Kas*100;
plot(elas,Kas*scK,'k','linew',1)
hold on
end
% Somehow normalize this to the effective bandwidth as percentage
% leaked to, from and within the effective bandwidth
% Here do the log scaling
K=decibel(K(llast+1,:));
minb=min(K);
maxb=-minb;
tix=[0:10:maxb];
widr=[0 5];
b=bar(0-llast:Lmax-llast,K-minb,1);
set(b,'FaceC',grey,'EdgeC','k')
set(gca,'ytick',sort(maxb-tix),'ytickl',fliplr(-tix))
ylim(minmax(K-minb)+widr+[max(K-minb)-30 0])
xlim([-skel(aN) skel(aN)])
tixx{ondex}=0:tb(ondex):round(skel(aN)/10)*10;
xl(ondex)=xlabel(xtag);
yl(ondex)=ylabel(sprintf(['K_{ll''} (dB)']));
% Put in cap size labels
legsi{ondex}=sprintf(' %s = %i%s','\Theta',TH1(ondex),str2mat(176));
[bh(ondex),th(ondex)]=boxtex('ur',ha(ondex),legsi{ondex},12,1,1);
[bh2(ondex),th2(ondex)]=boxtex('ul',ha(ondex),...
sprintf('%i%s',100-round(Ksum*100),'%'),12,1,1);
delete(bh2(ondex))
% Equivalent wavelength axis
[ax(ondex),axl(ondex)]=...
xtraxis(ha(ondex),sort([-skel(1:aN) 0 skel(1:aN)]),-aN:aN,...
['number of wavelengths per cap']);
set(ax(ondex),'xgrid','on')
% Put the cap logo on
lah(ondex)=caplogo(ha(ondex),1,cloc,1/logsk,1/logsk,20);
end
clear llast
% Now for the double cap
for ondex=1:length(TH2)
axes(ha(ondex+length(TH1)))
% Get effective bandwidth thingies
for N=1:max(5,aN)
skel(N)=max(roots([1 1 -(N*180./(90-TH2(ondex)))^2]));
end
% Get the boxcar coupling kernel
K=bcoupling(TH2(ondex),Lmax,2);
% Target degree (not an index)
llast=Lmax-ceil(skel(aN))-offs;
disp(sprintf('We show target degree l = %i',llast))
% Check the row sum, which isn't going to be 100, but just about
Ksum=sum(K(llast+1,...
max(1,llast-ceil(skel(aN)))+1:min(llast+ceil(skel(aN))+1,Lmax+1)));
disp(sprintf('Row sum at degree shown %8.3f',Ksum*100))
if as==1
% And get the asymptotic representation fake for the last one
[Kas,elas]=buniversal(TH2(ondex),Lmax,0,2);
% What seems to be the scaling factor here?
scK=K(llast,llast)/max(Kas);
disp(sprintf('Scaling is %8.3f',scK))
Kas=Kas*100;
% Plot asymptotic result?
plot(elas,Kas,'k','linew',1)
hold on
end
% Somehow normalize this to the effective bandwidth as percentage
% leaked to, from and within the effective bandwidth
% No, do the log scaling but watch for the zeros
K(K==0)=NaN;
K=decibel(K(llast+1,:));
minb=min(K);
maxb=-minb;
tix=[0:10:maxb];
widr=[0 5];
b=bar(0-llast:Lmax-llast,K-minb,1);
set(b,'FaceC',grey,'EdgeC','k')
set(gca,'ytick',sort(maxb-tix),'ytickl',fliplr(-tix))
ylim(minmax(K-minb)+widr+[max(K-minb)-30 0])
xlim([-skel(aN) skel(aN)])
tixx{ondex+length(TH1)}=0:tb2(ondex):round(skel(aN)/10)*10;
xl(ondex+length(TH1))=xlabel(xtag);
yl(ondex+length(TH1))=ylabel(sprintf(['K_{ll''} (dB)']));
% Put in cap size labels
legsi{ondex+length(TH1)}=...
sprintf(' %s = %i%s','\Theta',90-TH2(ondex),str2mat(176));
[bh(ondex+length(TH1)),th(ondex+length(TH1))]=...
boxtex('ur',ha(ondex+length(TH1)),legsi{ondex+length(TH1)},12,1,1);
[bh2(ondex+length(TH1)),th2(ondex+length(TH1))]=...
boxtex('ul',ha(ondex+length(TH1)),...
sprintf('%i%s',100-round(Ksum*100),'%'),12,1,1);
delete(bh2(ondex+length(TH1)))
% Equivalent wavelength axis
[ax(ondex+length(TH1)),axl(ondex+length(TH1))]=...
xtraxis(ha(ondex+length(TH1)),sort([-skel(1:aN) 0 skel(1:aN)]),...
-aN:aN,['number of wavelengths per cap']);
set(ax(ondex+length(TH1)),'xgrid','on')
% Put the cap logo on
lah(ondex+length(TH1))=...
caplogo(ha(ondex+length(TH1)),3,cloc,1/logsk,1/logsk,20);
end
% Cosmetic arrangements
longticks([ah ax])
delete(axl([2:3 5:6]))
delete(xl([1:2 4:5]))
nolabels(ax([2:3 5:6]),1)
for ondex=1:length(ha)
set(ha(ondex),'xtick',unique([-tixx{ondex} tixx{ondex}]))
end
set(th2,'FontS',8)
movev(lah,.003)
set(gcf,'color','w','inverthardcopy','off')
if as==1
figdisp([],as)
else
figdisp
end
% Make the extra axis come last
for index=1:length(ah)
axes(ah(index))
set(ah(index),'color','none')
end
% But make sure the logo's show!
for indx=1:length(lah)
top(lah(indx))
end