1 | pdfs; % load example pdfs |
---|
2 | |
---|
3 | f1=N1a; |
---|
4 | f2=N2a; |
---|
5 | f3=Ga; |
---|
6 | |
---|
7 | % merger |
---|
8 | Merger.class='merger_base'; |
---|
9 | Merger.beta=1; |
---|
10 | |
---|
11 | % support |
---|
12 | support.grid={[-5,5]}; |
---|
13 | support.nbins=[100]; |
---|
14 | |
---|
15 | % 1D |
---|
16 | Merger.method='arithmetic'; |
---|
17 | [vy]=merger({f1,f2},support,Merger) |
---|
18 | figure(1) |
---|
19 | subplot(1,3,1); |
---|
20 | hold off |
---|
21 | plot(vy.support,vy.weights,'-') |
---|
22 | hold on |
---|
23 | plot(vy.support,vy.source1,'--') |
---|
24 | plot(vy.support,vy.source2,'--') |
---|
25 | |
---|
26 | Merger.method='lognormal'; |
---|
27 | [vy]=merger({f1,f3},support,Merger) |
---|
28 | subplot(1,3,2); |
---|
29 | hold off |
---|
30 | plot(vy.support,vy.weights,'-') |
---|
31 | hold on |
---|
32 | plot(vy.support,vy.source1,'--') |
---|
33 | plot(vy.support,vy.source2,'--') |
---|
34 | |
---|
35 | Merger.method='geometric'; |
---|
36 | [vy]=merger({f1,f2},support,Merger) |
---|
37 | subplot(1,3,3); |
---|
38 | hold off |
---|
39 | plot(vy.support,vy.weights,'-') |
---|
40 | hold on |
---|
41 | plot(vy.support,vy.source1,'--') |
---|
42 | plot(vy.support,vy.source2,'--') |
---|
43 | |
---|
44 | %% |
---|
45 | f3=Nab; |
---|
46 | f4=GiW; |
---|
47 | |
---|
48 | % 2D support |
---|
49 | type=0; |
---|
50 | if type==0 |
---|
51 | support2.grid={[-5,5],[0.001,5]}; |
---|
52 | support2.nbins=[10,10]; |
---|
53 | else |
---|
54 | support2=struct('pdf',... |
---|
55 | struct('class','enorm<ldmat>','mu',[1,2],'R',[2 0; 0 2])); |
---|
56 | support2.nsamples=[100]; |
---|
57 | end |
---|
58 | |
---|
59 | % 2D |
---|
60 | vy2=merger({f3,f4},support2,Merger) |
---|
61 | |
---|
62 | if type==0 |
---|
63 | X=zeros(support2.nbins(1)); |
---|
64 | Y=zeros(support2.nbins(1)); |
---|
65 | Z=zeros(support2.nbins(1)); |
---|
66 | |
---|
67 | X(:)=vy2.support(1,:); |
---|
68 | Y(:)=vy2.support(2,:); |
---|
69 | Z(:)=vy2.weights(:); |
---|
70 | |
---|
71 | figure(2); |
---|
72 | subplot(1,3,1); |
---|
73 | contour(X,Y,Z); |
---|
74 | subplot(1,3,2); |
---|
75 | Z(:)=vy2.source1(:); |
---|
76 | contour(X,Y,Z,'--'); |
---|
77 | subplot(1,3,3); |
---|
78 | Z(:)=vy2.source2(:); |
---|
79 | contour(X,Y,Z,'--'); |
---|
80 | else |
---|
81 | figure(2); |
---|
82 | subplot(1,3,1); |
---|
83 | hold off |
---|
84 | plot(vy2.support(1,:),vy2.support(2,:),'.','MarkerSize',4) |
---|
85 | hold on |
---|
86 | contour_2(vy2.support(1,:),vy2.support(2,:),vy2.weights) |
---|
87 | subplot(1,3,2); |
---|
88 | contour_2(vy2.support(1,:),vy2.support(2,:),vy2.source1) |
---|
89 | subplot(1,3,3); |
---|
90 | contour_2(vy2.support(1,:),vy2.support(2,:),vy2.source2) |
---|
91 | end |
---|