-
Notifications
You must be signed in to change notification settings - Fork 0
/
plotBoxAgg.asv
94 lines (87 loc) · 2.67 KB
/
plotBoxAgg.asv
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
function f=plotBoxAgg(A,D)%(f,NN,D)%(B1,B2,B3,B4)%,NN
[a,b]=size(D);
v=(2:2:20); lv=length(v);%2:2:20
meanA=zeros(1,lv);
aggBefore=0;
if aggBefore==1
D=B1+B2+B3+B4;
c1=aggCells(B1,v(1)); [a,b]=size(c1);
flist=NaN(a*b,lv);
else
Abefore=
f=A(:,1);
flist=NaN(length(f),lv);
end
if aggBefore==1
for i=1:lv
c1=aggCells(B1,v(i));
c2=aggCells(B2,v(i));
c3=aggCells(B3,v(i));
c4=aggCells(B4,v(i));
[gamma,NN,n,nbar,na,NNbar,NNrep,minNind,maxNind,maxN,Kbar,K1,Cbar,betaS,betaI,betaD,ages0]=prepFluAge(c1,c2,c3,c4,1.8,0,v(i)/10);
[f,g]=finalSizeMulti(gamma,n,nbar,na,NN,NNbar,NNrep,minNind,maxNind,maxN,Kbar,K1,Cbar,betaD,1,2,10^(-16));
flist(1:length(f),i)=f;%.*NN;%********test case
meanA(i)=nanmean(f.*NN);
end
else
%c1=aggCells(B1,v(1));
%c2=aggCells(B2,v(1));
%c3=aggCells(B3,v(1));
%c4=aggCells(B4,v(1));
%[gamma,NN,n,nbar,na,NNbar,NNrep,minNind,maxNind,maxN,Kbar,K1,Cbar,betaS,betaI,betaD,ages0]=prepFluAge(c1,c2,c3,c4,1.8,0,v(1));
%[f,g]=finalSizeMulti(gamma,n,nbar,na,NN,NNbar,NNrep,minNind,maxNind,maxN,Kbar,K1,Cbar,betaD,1,2,10^(-16));
flist(1:length(f),1)=f;
for i=2:lv
[fnew,NNnew]=aggResult(D,f,v(i)/2);
flist(1:length(fnew),i)=fnew;
meanA(i)=nanmean(fnew.*NNnew);
end
end
%A=padcat(v);
A=flist;
f=A;
%}
%rangeA=range(A,1);
%repN=repmat(NN,1,size(A,2));
%meanA=nanmean(A.*repN,1);
meanA=nanmean(A,1);
quantA=quantile(A,[0,.25,.5,.75,1],1);
labels=cellstr(num2str(v'));
maxA=max(max(A))+.1;
maxA=min(1,maxA);
fs=12; lw=1;
%{
figure
hold on
plot(v,meanA','-','color',[0,.25,.25],'linewidth',lw)
%plot(v,quantA,'o-','linewidth',lw)
fanChart(v,quantA');
%boxplot(A,'labels',labels,'position',v,'colors',[0.0512,0.4600,0.8633],'PlotStyle','compact','Notch','off','whisker',100000);%plot(v,meanA,'-','color',[0,.5,.5],'linewidth',2) %'labels',num2str(v),'position',v,
axis([v(1)-2,v(end)+2,0,min(maxA+.1,1)]);%maxA
grid on
grid minor
xlabel('Resolution (x100m)','FontSize',10); ylabel('Attack rate','FontSize',fs); set(gca,'FontSize',10)%Proportion immune M_{80}
%}
figure
maxA=max(max([Abefore;Aafter]));
maxA=min(maxA+.1,1);
subplot(2,1,1)
hold on
plot(v,meanA','-','color',[0,.25,.25],'linewidth',lw)
fanChart(v,A');
hold off
axis([v(1)-2,v(end)+2,0,maxA]);
grid on
grid minor
xlabel('Resolution (x100m)'); ylabel('Attack rate');
set(gca,'FontSize',fs)
subplot(2,1,2)
hold on
plot(v,meanA','-','color',[0,.25,.25],'linewidth',lw)
fanChart(v,quantA');
hold off
axis([v(1)-2,v(end)+2,0,maxA]);
grid on
grid minor
xlabel('Resolution (x100m)'); ylabel('Attack rate');
set(gca,'FontSize',fs)