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