root/applications/bdmtoolbox/tutorial/merging/merge_mix.m @ 949

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

eol-native

  • Property svn:eol-style set to native
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   = 3;
9f1.R    = 1;
10f1.rv   = a;
11
12f2 = struct('class','enorm<ldmat>',...
13    'mu',-3,...
14    'R',  2,...
15    'rv', a);
16
17
18% merger
19merger.class='merger_mix';
20merger.method='lognormal';
21merger.beta=2;
22merger.ncoms=20;
23merger.stop_niter=5;
24merger.effss_coef=1;
25%merger.dbg_file='merger_mix_dbg';
26
27% support
28support.grid={[-5,5]};
29support.nbins=[100];
30
31% 1D
32[vy]=merger_mx({f1,f2},support,merger)
33figure(1)
34hold off
35plot(vy.support,vy.weights,'.')
36hold on
37plot(vy.support,vy.source1,'.r')
38plot(vy.support,vy.source2,'.r')
39
40% wx=vy.weights;
41% [n,x]=hist(wx,15);
42% bar(x,(n.*wx)/sum(n.*wx));
43
44% 2D sources
45f3 = struct('class','enorm<ldmat>',...
46    'mu',[1,2],...
47    'R',  [2 0; 0 1.5],...
48    'rv', ab);
49f4 = struct('class','egiw',...
50    'V',4*[5 2; 2 1],...
51    'nu',  4,...
52    'dimx',  1,...
53    'rv', ab);
54% 2D support
55support2.grid={[-5,5],[0.001,5]};
56support2.nbins=[20,20];
57
58% 2D
59vy2=merger_mx({f3,f4},support2,merger)
60X=zeros(support2.nbins(1));
61Y=zeros(support2.nbins(1));
62Z=zeros(support2.nbins(1));
63
64figure(2);
65subplot(1,3,1);
66hold off
67plot(vy2.support(1,:),vy2.support(2,:),'.','MarkerSize',4)
68hold on
69contour_2(vy2.support(1,:),vy2.support(2,:),vy2.weights)
70subplot(1,3,2);
71contour_2(vy2.support(1,:),vy2.support(2,:),vy2.source1)
72subplot(1,3,3);
73contour_2(vy2.support(1,:),vy2.support(2,:),vy2.source2)
Note: See TracBrowser for help on using the browser.