root/applications/bdmtoolbox/tutorial/merging/merge_grid.m @ 958

Revision 706, 2.0 kB (checked in by smidl, 15 years ago)

eol-native

  • Property svn:eol-style set to native
Line 
1pdfs; % load example pdfs
2
3f1=N1a;
4f2=N2a;
5f3=Ga;
6
7% merger
8Merger.class='merger_base';
9Merger.beta=1;
10
11% support
12support.class='rectangular_support';
13support.ranges={[-5,5]};
14support.gridsizes=[100];
15
16% 1D
17Merger.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
27Merger.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
36Merger.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%%
46f3=Nab;
47f4=GiW;
48
49% 2D support
50type=1;
51if type==0
52    support2.class='rectangular_support';
53    support2.ranges={[-5,5],[0.001,5]};
54    support2.gridsizes=[10,10];
55else
56    support2.class='discrete_support';
57    support2.epdf= struct('class','enorm<ldmat>','mu',[1,2],'R',[2 0; 0 2]);
58    support2.npoints=[100];
59end   
60
61% 2D
62vy2=merger({f3,f4},support2,Merger)
63
64if 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,'--');
82else
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)
93end
Note: See TracBrowser for help on using the browser.