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

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

Working unitsteps and controlloop + corresponding fixes

  • Property svn:eol-style set to native
Line 
1% Random Variables
2a=RV({'a'});
3b=RV({'b'});
4ab=RVjoin([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=0.9;
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.class='rectangular_support';
35support2.ranges={[-5,5],[0.001,9]};
36support2.gridsizes=[30,30];
37
38% 2D
39%vy2=merger({f3,f1}, support2, Merger)
40vy2=merger({f3,f4}, support2, Merger)
41
42figure(2);
43subplot(2,2,1);
44contour_2(vy2.support(1,:),vy2.support(2,:),vy2.source1)
45% set(gca,'XLim',[-5,5])
46% set(gca,'YLim',[-1,7])
47title('Source 1')
48subplot(2,2,2);
49contour_2(vy2.support(1,:),vy2.support(2,:),vy2.source2')
50% set(gca,'XLim',[-5,5])
51% set(gca,'YLim',[-1,7])
52title('Source 2')
53
54subplot(2,2,3);
55hold off
56contour_2(vy2.support(1,:),vy2.support(2,:),vy2.mix)
57% set(gca,'XLim',[-5,5])
58% set(gca,'YLim',[-1,7])
59title('Mixture Approximation')
60
61subplot(2,2,4);
62hold off
63plot(vy2.support(1,:),vy2.support(2,:),'.','MarkerSize',4)
64hold on
65contour_2(vy2.support(1,:),vy2.support(2,:),vy2.weights)
66% set(gca,'XLim',[-5,5])
67% set(gca,'YLim',[-1,7])
68title('Weighted Empirical')
69
Note: See TracBrowser for help on using the browser.