root/applications/bdmtoolbox/tutorial/merging/merge_frag.m @ 429

Revision 429, 1.4 kB (checked in by smidl, 15 years ago)

merger changes + corresponding fixes

Line 
1% Random Variables
2a=struct('class','RV','names',{{'a'}});
3b=struct('class','RV','names',{{'b'}});
4ab=struct('class','RV','names',{{'a','b'}});
5
6% Sources
7f1.class= 'enorm<ldmat>';
8f1.mu   = 5;
9f1.R    = 1;
10f1.rv   = b;
11
12% merger
13Merger.class='merger_mix';
14Merger.method='lognormal';
15Merger.beta=1.2;
16Merger.ncoms=20;
17Merger.stop_niter=50;
18Merger.effss_coef=1;
19%Merger.dbg_file='merger_mix_dbg';
20
21
22% 2D sources
23f3 = struct('class','enorm<ldmat>',...
24    'mu',[1,2],...
25    'R',  [1 -0.5; -0.5 1],...
26    'rv', ab);
27f4 = struct('class','mlnorm<ldmat>',...
28    'rv',a,...
29    'rvc', b,...
30    'A',  1,...
31    'const', 0,...
32    'R',1);
33% 2D support
34support2.grid={[-5,5],[0.001,9]};
35support2.nbins=[30,30];
36
37% 2D
38%vy2=merger({f3,f1}, support2, Merger)
39vy2=merger({f3,f4}, support2, Merger)
40
41figure(2);
42subplot(2,2,1);
43contour_2(vy2.support(1,:),vy2.support(2,:),vy2.source1)
44% set(gca,'XLim',[-5,5])
45% set(gca,'YLim',[-1,7])
46title('Source 1')
47subplot(2,2,2);
48contour_2(vy2.support(1,:),vy2.support(2,:),vy2.source2')
49% set(gca,'XLim',[-5,5])
50% set(gca,'YLim',[-1,7])
51title('Source 2')
52
53subplot(2,2,3);
54hold off
55contour_2(vy2.support(1,:),vy2.support(2,:),vy2.mix)
56% set(gca,'XLim',[-5,5])
57% set(gca,'YLim',[-1,7])
58title('Mixture Approximation')
59
60subplot(2,2,4);
61hold off
62plot(vy2.support(1,:),vy2.support(2,:),'.','MarkerSize',4)
63hold on
64contour_2(vy2.support(1,:),vy2.support(2,:),vy2.weights)
65% set(gca,'XLim',[-5,5])
66% set(gca,'YLim',[-1,7])
67title('Weighted Empirical')
68
Note: See TracBrowser for help on using the browser.